Hi all,
I need to execute a script every time PLAY RECAP failed=1, how can I configure my Ansible Playbook to do this?
Thanks.
Hi all,
I need to execute a script every time PLAY RECAP failed=1, how can I configure my Ansible Playbook to do this?
Thanks.
Check Ansible block. It has a rescue section.
Hi Tcpip,
You must use this syntax task :
- name: my task
shell: ./my_script
when: my_variable == “1”
./my_script ==> the way of my script with a point front
my_variable can be PLAY_RECAP
tell me about this solution please.
Thank you
Hello ryad9200000,
I can this variable info at the end of my playbook so when I fails It will run the script. If I put PLAY_RECAP ==“0” this will mean that the playbook finished ok ?
Thanks for your help.
Hello Stefan,
I will take it a look,
thanks for your help.
This is the playbook Im using for test.
If you spot, in the logs, it shows that it’s breaking on the “ethernet0/1”, and, if I read it right that’s in the “/” in that… So it’s probably worth wrapping any instance of “ethernet0/1” in quotes, like I did.
Give that a whirl, and try again
Hello Jon
Yes I know the issue and it was intentional, what Im trying to do is to test if this works or not.
Thanks.