Hi guys,
Ran a playbook against 2 hosts: host1 and host2
Extract of playbook:
roles:
- role: a
- role: b
- role: c
post_tasks:
- name: Post Task 1
::::::::::::::::::::::::::
- name: Post Task 2
::::::::::::::::::::::::::
- name: Post Task 3
::::::::::::::::::::::::::
In role c the main task is like:
- include: x.yml
- include: y.yml
- include: z.yml
rescue:
- fail: msg="There was a failure in main!!"
y.yml is like:
- name: Task 1
::::::::::::::::::::::::::
- name: Task 2
::::::::::::::::::::::::::
- name: Task 3
::::::::::::::::::::::::::
rescue:
- fail: msg="There was a failure in y!!"
host2 failed a task in y.yml. As expected all other tasks in z.yml were executed for host1
However, neither host1 or host2 executed any of the post tasks. I did not expect this to be the behavior. I thought host1 should execute the post tasks.
Could anybody please help me to understand why this happens and suggest how to make sure the post_tasks execute for hosts which have not had any role task failures?
Preferably while still using post_tasks.
Thanks a lot,
Daniel