Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
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