Junior — Middle
What initiates the execution of roles and playbooks in Ansible automation: a role or a playbook?
sobes.tech AI
Answer from AI
In Ansible, execution is initiated by a playbook. The playbook describes a sequence of tasks and specifies which roles and tasks should be executed on target hosts. Roles are structured sets of tasks, files, templates, and variables used within the playbook for organization and reuse of code.
That is, the playbook calls roles, and roles themselves are not run directly. The playbook determines when and which roles should be applied.
Example of a playbook calling a role:
- hosts: webservers
roles:
- nginx