I am trying to create a master playbook where I am including multiple roles
in it. I am using block for each role in playbook along with rescue and
fail section. Rescue section should perform rollback of the previous
completed role and should fail playbook after rolling back and email failed
details. I tried rescue section and it works but playbook does not fail and
continue to next role. I tried fail inside rescue section that does not
work as well. I can create fail task after completion of every block to
fail the playbook but not sure how to register previous role's results. Can
anyone help how to achieve this? Also, for email I was thinking to register
the output of block in a var and send as email but register does not work
with block. I appreciate your help. Thanks
- hosts: all
- include_vars: 'vars.yml'
- include_vars: 'vault1.yml'
- name Role1
- name: Role2
# - fail:
# msg: "Error: Role1 failed.”
- name: Debug msg
debug: msg="Error:Role 1 failed..Rolling back role1."
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.