ansible playbook execute in this order: task, role, task, role, task


Forgive my newbie question, but I would like to execute three tasks and use two roles in a playbook, in the order:

  1. task
  2. role
  3. task
  4. role
  5. task

This is what I have so far (task, role, task):

Is this possible or should I be changing my tasks into roles?


I recommend you create roles for post and pre tasks for you ansible.

Your site.yml must be some like this:

in roles folder you must have three roles, pre, post and main_role.

Leave a Reply