Junior — Middle
If a specific playbook specifies three tasks, what is the total number that will be executed?
sobes.tech AI
Answer from AI
If an Ansible playbook specifies three tasks, then all three tasks will be executed sequentially when running the playbook, meaning the total number of executed tasks is three.
Each task is a separate step that Ansible performs on target hosts. If the playbook contains multiple hosts, each task will be executed on each of them, but the number of tasks in the playbook remains three.
Example:
- hosts: all
tasks:
- name: Install package
apt:
name: nginx
state: present
- name: Start service
service:
name: nginx
state: started
- name: Check status
command: systemctl status nginx