Ansible Playbook Lab-2
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
---
- name: Create a Deploy group
hosts: web
tasks:
- name: create group "deploy"
group:
name: deploy
state: present
---
- name: Create a user "deploy-user"
hosts: web
tasks:
- name: create a user "deploy-user"
user:
name=deploy-user groups=deploy shell=/bin/bash
state=present
---
- name: Install package httpd server
hosts: web
tasks:
- name: Install package httpd
yum:
name=httpd
state=absent
---
- name: To start and enable httpd service
hosts: web
tasks:
- name: start httpd
service:
name: httpd
state: started
- name: enable httpd
service:
name: httpd
enabled: yes
---
- name: creat a file index.html in path
hosts: web
tasks:
- name: create a file index.html
file:
path: "/var/www/htmlindex.html"
state: touch
---
- name: Reboot self machine
hosts: web
tasks:
- name: Reboot self machine
reboot:
reboot_timeout: 3600
---
- name: Reboot self machine
hosts: web
tasks:
- name: Reboot self machine
reboot:
reboot_timeout: 3600
---
- name: To install a package git,wget
hosts: web
tasks:
- name: Install git
yum:
name: git
state: present
- name: Install wget
yum:
name: wget
state: latest
---
- name: Clone git repo
hosts: web
tasks:
- name: clone git repo
git:
dest: /home/centos/bhavya
repo: "https://github.com/scmgalaxy/ansible-role-template"
clone: yes