Does anyone know why handlers get executed on ALL members of a group when
only one member met the conditional??? See below...
Here is the pastebin info << sanitized>>
When I execute our top level playbook site.yml on a group that contains
multiple hosts...even though only one host results in a "changed" status
for the task...the handlers get executed on ALL members of the group
members of our_group:
host1.ourdomain.com
host2.ourdomain.com
top level playbook site.yml:
---
- name: PLAY 1 - Apply common roles to Inventory Group
hosts: our_hosts
serial: 10
roles:
- { role: dnsclient }
- { role: autofs }
- { role: local_users }
- { role: nis_client } << --- This is the role in which the handler
is called
nis_client role task with handler:
- name: Create /etc/yp.conf from template and Restart ypbind
template: src=yp.conf.j2 dest=/etc/yp.conf owner=root group=root
mode=0644
notify:
- stop ypbind
- start ypbind
- restart autofs
tags:
- provision
- config
- nis_client
nis_client role handlers main.yml:
---
- name: stop ypbind
command: service ypbind stop
- name: start ypbind
command: service ypbind start
- name: restart autofs
service: name=autofs state=restarted
result of run:
TASK: [nis_client | Create /etc/nsswitch.conf from template]
******************
ok: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
TASK: [nis_client | Create /etc/sysconfig/ypbind from template]
***************
ok: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
TASK: [nis_client | Ensure that rpcbind is started]
***************************
ok: [host1.ourdomain.com]
ok: [host2.ourdomain.com.com]
TASK: [nis_client | Create /etc/yp.conf from template and Restart ypbind]
*****
ok: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
NOTIFIED: [nis_client | stop ypbind]
******************************************
changed: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
NOTIFIED: [nis_client | start ypbind]
*****************************************
changed: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
NOTIFIED: [nis_client | restart autofs]
***************************************
changed: [host1.ourdomain.com]
changed: [host2.ourdomain.com]
PLAY RECAP
********************************************************************
host1.ourdomain.com : ok=4 changed=3 unreachable=0 failed=0
host2.ourdomain.com : ok=7 changed=7 unreachable=0 failed=0
Finished: SUCCESS
--
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/7de5cbed-de44-44f9-b183-a0f638838f19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.