Example of Multple Ansible Play in One Playbook
---
- name: sample1
hosts: localhost
gather_facts: no
tasks:
- name: sample_task1
debug:
msg: "sample 1 task 1"
- name: sample2
hosts: localhost
gather_facts: no
tasks:
- name: sample_task2
debug:
msg: "sample 2 task 2"
Example of Multple Ansible Playbook in One Yaml file
Build many sub-playbooks and aggregate them via include statements.
- include: playbook-one.yml
- include: playbook-two.yml
Note -
include is deprecated. docs.ansible.com/ansible/latest/playbooks_reuse.html import_playbook: foo is the right way to go
For newer versions of Ansilbe, you can build many sub-playbooks and aggregate them via import_playbook statements:
---
- import_playbook: A-systemd-networkd.yml
- import_playbook: B-fail2ban-ssh.yml
- import_playbook: C-enable-watchdog.yml
Ansible Fundamental tutorial by Manish in 2020
Ansible Advance Tutorial for Beginners with Demo 2020 — By DevOpsSchool
Ansible with network module (Part 01) — By DevOpsSchool
Ansible with network module (Part 02) — By DevOpsSchool
Ansible with network module (Part 03) — By DevOpsSchool
Ansible with network module (Part 04) — By DevOpsSchool
Ansible with network module (Part 05) — By DevOpsSchool
Ansible with network module (Part 06) — By DevOpsSchool
Ansible with network module (Part 07) — By DevOpsSchool
Ansible with network module (Part 08) — By DevOpsSchool
Ansible with network module (Part 09) — By DevOpsSchool
Ansible with network module (Part 10) — By DevOpsSchool
Ansible with network module (Part 11) — By DevOpsSchool
Ansible with network module (Part 12) — By DevOpsSchool
Ansible with network module (Part 13) — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024
- Introduction to System Operations (SymOps) - October 30, 2024