Ansible Multiple playbook exercise

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



1. Write a 3 yaml playbook i.e main.yaml, second.yaml and third.yaml with some demo debug tasks and call second.yaml and third.yaml from main.yaml using inlcude.

-------------------------------------second.yaml-------------------------------

---
- name: Update web servers
  hosts: web

  tasks:
  - name: Install the latest version of Apache
    yum:
      name={{ packagename }}
      state=latest
  - name: Copy file with owner and permissions
    ansible.builtin.copy:
      src: index.html
      dest: /var/www/html/index.html

--------------------------------------third.yaml----------------------------------

- name: Update web servers
  hosts: db

  tasks:
  - name: Start service httpd, if not started
    ansible.builtin.service:
      name={{ servicename }}
      state=started
  - name: include default step variables
    include_vars: var-include.yml
  - name: Print the vars
    ansible.builtin.debug:
      msg: My name {{ myname }} and My age is {{ age }}

 ------------------------------------main.py-------------------------------------
 - include: second.yaml
 - include: third.yaml

Code language: PHP (php)