I have a playbook with a block where I am doing a string comparison on a block like so. Imagine my inventory_hostname is "hello-test.com", in other words this entire block should be skipped.
- name: Do cool stuff
block:
- name: Some tasks
set_fact: feeder="feeder.stuff.com"
when: ("'hello-prod.com' in inventory_hostname")
If I run it like above, it will skip it. However, If I run it with an or, like below it does not skip it even though inventory_hostname does not match either comparison
- name: Do cool stuff
block:
- name: Some tasks
set_fact: feeder="feeder.stuff.com"
when: ("'hello-prod.com' in inventory_hostname") or ("'hello-cool-prod.com' in inventory_hostname")
I've never had to use an or before in a when statement, what am I missing?