I have wrriten below script to check if switch is in state mentioned in
WHEN condition and to end playbook if so. But when condition doesn't work
when i use 'OR' conditional to check for multiple conditions.
I tried different ways of writing the OR syntax as given below but didn't
work. What am i doing wrong?
SYNTAX 1:
name: GATHER STACK INFO
ios_command:
commands: "show switch"
register: print_showswitch
- name: END THIS PLAYBOOK IF ALL MEMBER SWITCHES ARE NOT IN READY STATE
meta: end_host
when: - "'Waiting' in print_showswitch.stdout[0]" or
- "'Progressing' in print_showswitch.stdout[0]" or
- "'Initializing' in print_showswitch.stdout[0]"
SYNTAX 2:
when:
- ("'Waiting' in print_showswitch.stdout[0]") or ("'Progressing' in
print_showswitch.stdout[0]")
SYNTAX 3:
when:
- ("'Waiting' in print_showswitch.stdout[0]" or "'Progressing' in
print_showswitch.stdout[0]")
Thanks,
Vikram
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/395a7793-3e36-4a59-80fe-4ee2c5886bf2n%40googlegroups.com.