Ansible revert back operation

19 views
Skip to first unread message

Preethi Muruganantham

unread,
Jun 24, 2019, 2:33:34 AM6/24/19
to Ansible Development
I have three IPs (machines) listed in the inventory file.
I have to run the playbook in all the 3 mchines.
For eg., Lets consider I am deploying the application in all the 3 machines.
When the deployment fails in any of the machines it has to revert back the operations in all the 3 machines/(or to the machines where the deployment is completed) eventhough it is successfully deployed.
I have the revert_back playbook written seperately.

Is there any way in ansible to achieve this requirement?

It will be helpful for me if anyone could guide me in achieving this requirement.

Db0

unread,
Jun 24, 2019, 3:35:16 AM6/24/19
to Preethi Muruganantham, Ansible Development
Instead of reverting the operation, it might be better to instruct ansible to perform the operation serially rather than on parallel. Then if the operation fails on one, it won't run on the  others, and you have to run the revert_back playbook manually.

You can use a block rescue: to run the revert tasks automatically, but this will consider the run a success, so you'll also need to include a custom failed: tak in your block to prevent other systems from being modified.,

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/c0fffe54-f2df-4383-a5f8-e346794a9f75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages