Ansible Playbook Lab & Excercise – Part 2

#first.yaml
- name: To create group deploy
  hosts: web

  tasks:
  - name: to create group deploy
    group:
      name: deploy
      state: present



#second.yaml
---
- name: To create group deploy which is part of deploy
  hosts: web

  tasks:
  - name: to create group deploy which is part of deploy
    user:
      name: deploy-user
      group: deploy
      state: present

#third.yaml
 ---
- name: to install package
  hosts: web

  tasks:
  - name: to install package
    yum:
      name: httpd
      state: present



#fourth.yaml
---
- name: to start and enable the service
  hosts: web

  tasks:
  - name: to start and enable the service
    service:
      name: httpd


#fifth.yaml
     
---
- name: create a file
  hosts: web

  tasks:
  - name: create a file
   file:
    path: /var/www/html
    state: file

#sixth.yaml
---
- name:  to reboot a self machine
  hosts: web

  tasks:
  - name:  to reboot a self machine
   reboot:
    reboot_timeout: 3600
   
---
- name: to install a package
  hosts: web

  tasks:
  - name: to install a package
   yum:
      name: git
      state: present

---
- name: to clone git repo
  hosts: web

  tasks:
  - name: to clone git repo
   git:
      dest: /home/centos/monika
      repo: "https://github.com/scmgalaxy/ansible-role-template"