write playbook
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
#first.yml
---
- name: create deploy group
hosts: web
tasks:
- name: create deploy group
ansible.builtin.group:
name: deploy
state: present
#second.yml
---
- name: create User in deploy group
hosts: web
tasks:
- name: create User in deploy group
user:
name: deploy-user
password: xyz
groups: deploy
state: present
shell: /bin/bash
#three.yml
---
- name: install httpd latest version
hosts: web
tasks:
- name: Install httpd
yum:
name: httpd
state: present
#four.yml
---
- name: start and enable the service
hosts: web
tasks:
- name: start and enable the service
ansible.builtin.service:
name: httpd
state: started
#five.yml
---
- name: some dummy html contents.
hosts: web
tasks:
- name: some dummy html contents.
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
#six.yml
---
- name: install a package called “git”, “wget”
hosts: web
tasks:
- name: install a package called “git”, “wget”
yum:
name:
- git
- wget
state: started
#seven.yml
---
- name: some dummy html contents.
hosts: web
tasks:
- name: clone git repo. https://github.com/scmgalaxy/ansible-role-template.
ansible.builtin.git:
repo: https://github.com/scmgalaxy/ansible-role-template
dest: /home/centos/sandhya
#eight.yml
---
- name: restart
hosts: web
tasks:
- name: Restart machine
reboot: