---
- name: Test when functionality.
hosts: all
tasks:
- name: Output inventory_hostname.
debug:
msg: "The inventory hostname is {{ inventory_hostname }}."
- 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
...
# vim: set ft=ansible:
when: ("{{ inventory_hostname }}" in groups["web"]) or ("{{ inventory_hostname }}" in groups["web_backend"])
ignore_errors: true
notify: restart httpd
...
# vim: set ft=ansible: