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., On Mon, Jun 24, 2019 at 8:33 AM Preethi Muruganantham < preethi1010....@gmail.com> wrote: > 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. > > -- > 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-devel+unsubscr...@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 > <https://groups.google.com/d/msgid/ansible-devel/c0fffe54-f2df-4383-a5f8-e346794a9f75%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/CABSCkdNywtd%2Bs7jZdgh_oP0nEJshQs7FSpZ2W4%2BnNK1%3DWX4z%2BA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.