Ansible Multiple playbook exercise

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare


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)