Forgive my newbie question, but I would like to execute three tasks and use two roles in a playbook, in the order:
- task
- role
- task
- role
- task
This is what I have so far (task, role, task):
---
- name: Task Role Task
hosts: 127.0.0.1
connection: local
gather_facts: false
pre_tasks:
- name: Do this task first
foo:
roles:
- role: this role second
foo:
post_tasks:
- name: Do this task third
foo:
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.