On 15. nov. 2016 16:53, Steven Smith wrote:
This is the play I am trying to get to run:
- name: Install httpd
yum: name=httpd state=latest disable_gpg_check=yes
when: (inventory_hostname in groups["web"]) or (inventory_hostname in
groups["web_backend"])
ignore_errors: true
notify: restart httpd
If my hosts file has nothing at all for "web" or "web_backend" I am hoping
it would just skip over this entire play instead of throwing this big red
error.
If either one of those are defined, then I want this play to run... can
anyone please help?
All variable that is not defined you'll need to filter through the
default filter, try this.
when: (inventory_hostname in groups["web"] | default([])) or
(inventory_hostname in groups["web_backend"] | default([]))
--
Kai Stian Olstad
--
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/d0346f3d-5ce8-4640-7a96-f4562acea179%40olstad.com.
For more options, visit https://groups.google.com/d/optout.