Ok, i will play with rescue fonctionnality for do one rollback if there is one error in my block.
Thank you very much for your answer goy !! ;) Regards, Le mardi 14 mai 2019 18:38:57 UTC+2, James Cassell a écrit : > > > > On Tue, May 14, 2019, at 12:08 PM, Ryad karkar wrote: > > Hey, > > > > It is really very interesting this section rescue but if in my block I > > execute for example a script sql which does a lot of actions and that > there > > is an error ... > > > > This is beyond the scope of ansible. You should have the rescue block do > what is necessary to recover from your SQL script, or use something like a > SQL transaction, but, again, it's beyond the scope of ansible. > > V/r, > James Cassell > > > So what to put in the rescue section? > > > > Thanks for your help ! :) > > > > Regards, > > > > > > Le mardi 14 mai 2019 18:01:00 UTC+2, Eric Hymowitz a écrit : > > > > > > 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/551eccb6-fb33-46f6-af40-894f709bb1bb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
