How to skip and move on to the next task if a condition is met?

14 views
Skip to first unread message

Amir Alavi

unread,
Jul 3, 2020, 7:51:31 AM7/3/20
to Ansible Development
Hi all,

Newbie here - I'm writing a playbook that I'm running a shell script and if the output is X then I want to skip the task and move on to the next task.
How do I do this?

Thanks

Magnus Lubeck

unread,
Jul 3, 2020, 8:31:24 AM7/3/20
to Amir Alavi, Ansible Development
You use "register: myVariable" on the shell task, then "when: myVariable.stdout == XY" on the next task.


//magnus

--
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-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/1645749e-5baa-4eba-91c5-0f24aa601d18o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages