Write Ansible Playbook to install & configure webserver & copy index.html file using variables

 - name: httpd install playbook
  hosts: all
  become: yes
  vars:
    v1: httpd
    v2: latest
    v3: started
    v4: restarted
  tasks:
    - name: Install httpd
      yum:
          name: "{{v1}}"
          state: "{{v2}}"
    - name: Start httpd service
      service:
         name: "{{v1}}"
         state: "{{v3}}"
    - name: copy index.html file
           copy:
               src: index.html
               dest: /var/www/html
    - name: restart httpd service
      service:
         name: "{{v1}}"
         state: "{{v4}}"

Comments

Popular posts from this blog

Top 10 Git Commands

Kubernetes cluster setup NOTES step by step using minikube

SonarQube Installation & Configuration Step by step