The problem you have is that ansible does not retain the old state of the machine when it makes changes. The fact that you executed the command "touch test_file.txt" does not indicate whether test_file.txt did or did not exist prior to running the command. So to "roll back", do you erase the file? Change the date-stamp back to what it was?
Probably the closest thing you will find is a "block" with a "rescue" section attached, to specify what you want to happen in the event of an error. https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html --EbH -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9576d408-ebbf-4cbe-b024-f25efaeb0476%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
