Example 1
hosts.yml
centos:
hosts:
provisioner:
ansible_connection: local
centos1:
ansible_host: '192.168.77.22'
ubuntu:
hosts:
ubuntu1:
ansible_host: '192.168.77.23'
playbook.yml
- name: Example playbook
hosts: all
tasks:
- name: Example task
command: whoami
Tip
Ansible Playbook's are used to gather multiple consecutive task executions. The tasks can be run synchronously, in parallel, in batches or match conditional clauses.
Execute the following command
ansible-playbook playbook.yml
Which modules will be run during this playbook execution?
This playbook execution will launch the setup and command modules on the remote hosts. The [Gathering Facts] section in ansible-playbook log corresponds to the execution of the setup module.
Bonus round
Using the debug module catch the ansible_distribution for each host.