In playbook we can define roles
, pre_tasks
, post_tasks
.
Can we also define tasks
?
And second question is about order of executing these things. I know that order is following: pre_tasks -> roles -> post_tasks
.
However, when tasks
are executed?
Playbook execution. A playbook runs in order from top to bottom. Within each play, tasks also run in order from top to bottom.
When you execute a playbook, in each play, all roles will be executed first, followed by the tasks, top down in the order that they are written.
Roles provide a framework for fully independent, or interdependent collections of variables, tasks, files, templates, and modules. In Ansible, the role is the primary mechanism for breaking a playbook into multiple files. This simplifies writing complex playbooks, and it makes them easier to reuse.
Role is a set of tasks and additional files to configure host to serve for a certain role. Playbook is a mapping between hosts and roles.
Here it is: http://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html?#using-roles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With