Ansible Playbook Lab-2

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

---
- 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
Code language: PHP (php)