Handlers getting executed on ALL hosts in a group when only one member of the group matched conditional (Ansible 1.6)

44 views
Skip to first unread message

Mark Raider

unread,
Feb 22, 2015, 2:34:47 PM2/22/15
to ansible...@googlegroups.com
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:



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] ****************** 

TASK: [nis_client | Create /etc/sysconfig/ypbind from template] *************** 

TASK: [nis_client | Ensure that rpcbind is started] *************************** 

TASK: [nis_client | Create /etc/yp.conf from template and Restart ypbind] ***** 


NOTIFIED: [nis_client | stop ypbind] ****************************************** 

NOTIFIED: [nis_client | start ypbind] ***************************************** 

NOTIFIED: [nis_client | restart autofs] *************************************** 

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

Matt Martz

unread,
Feb 22, 2015, 7:26:05 PM2/22/15
to ansible...@googlegroups.com
I'd recommend upgrading to ansible 1.8.x.

I do remember such an issue in a previous release, but 1.6 is pretty old at this point.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
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.


--
Matt Martz
@sivel
sivel.net

Mark Raider

unread,
Feb 23, 2015, 12:32:35 AM2/23/15
to ansible...@googlegroups.com
Thank you for the information...yes...you are right. That was the issue. I updated our version to 1.8.2 and things are working as expected. Thanks so much!

Mark
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages