Hello all,
I’m completely new to ansible here, so I apologize for any terminology mistakes. I’m running ansible 1.5 on CentOS 6. In setting up a playbook, I’ve come across an issue with how notify acts. Below are some snippets:
- name: deploy nslcd.conf file
copy: src=etc/nslcd.conf dest=/etc/nslcd.conf owner=root group=root mode=0600
notify: - restart nslcd
- refresh authconfig for nslcd
-
name: restart nslcd
service: name=nslcd state=restarted -
name: refresh authconfig for nslcd
command: /usr/sbin/authconfig --enableldap --update
When I run this against a system that’s already been configured, everything seems fine. When I delete the file and kill the process on one of the systems, however, I get the following. 1) The nslcd.conf file is copied only to the system where it is missing, as expected. 2) restart nslcd runs on both systems, even though it was only changed on one of them. 3) refresh authconfig for nslcd runs on both systems, again even though it was only needed on one system.
As far as I can tell, whenever a handler is called it acts against all of the hosts, not just those that were affected by the parent task. Is this simply how this works? Or am I missing something?
Thanks.