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
I get this error:
fatal: [rhel7]: FAILED! => {"failed": true, "msg": "The conditional check
'(inventory_hostname in groups[\"web\"]) or (inventory_hostname in
groups[\"web_backend\"])' failed. The error was: error while evaluating
conditional ((inventory_hostname in groups[\"web\"]) or (inventory_hostname
in groups[\"web_backend\"])): Unable to look up a name or access an
attribute in template string ({% if (inventory_hostname in groups[\"web\"])
or (inventory_hostname in groups[\"web_backend\"]) %} True {% else %} False
{% endif %}).\nMake sure your variable name does not contain invalid
characters like '-': argument of type 'StrictUndefined' is not
iterable\n\nThe error appears to have been in
'/etc/ansible/roles/httpd/tasks/enabled.yml': line 14, column 3, but
may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
offending line appears to be:\n\n\n- name: Install httpd\n ^ here\n"}
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?
--
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/39a47446-5981-4f16-aa95-92bb0ddc8de3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.