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/1557851925.3162858.1669194328.56775790%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.