Not sure if this has been asked before, but I needed to include some
playbooks conditionally, each of these was a top level that ran on
different hosts:
- include: play1.yml
when: "'var1 in some_list"
- include: play2.yml
when: "'var2' in some_list"
But apparently this doesn't work, no errors are generated, but the
playbooks are always inlcuded and run even when the condition is false. So
I took my conditions to another level inside and applied them to roles:
(play1.yml)
- hosts: hosts
user: root
roles:
- { role: role1, when: "'var1 in some_list" }
- { role: role2, when: "'var1 in some_list" }
But this results in a whole lot of skipped output in the run. There must a
cleaner way to do this?
Thanks
--
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/c4ce1f25-06ea-4b67-a22f-53b2038b9221%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.