<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.6.2</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">OS X 10.9.3</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Notification is executed when task was not changed.<br>
This behaviour occurs only on ansible 1.6.2 - earlier versions are ok.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">Simple play:<br>
tasks:<br>
- name: write /etc/ntp<br>
copy: src=ntp.conf dest=/etc/ntp.conf owner=root group=root mode=0644<br>
notify: restart ntp</p>
<p dir="auto">handlers:<br>
- name: restart ntp<br>
service: name=ntp state=restarted</p>
<p dir="auto">Two hosts: c01, c02. File /etc/ntp.conf is different than source on c01.</p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">TASK: [write /etc/ntp] ********************************************************<br>
ok: [c02]<br>
changed: [c01]</p>
<p dir="auto">NOTIFIED: [restart ntp] *******************************************************<br>
changed: [c01]</p>
<p dir="auto">PLAY RECAP ********************************************************************<br>
c01                        : ok=3    changed=2    unreachable=0    failed=0<br>
c02                        : ok=2    changed=0    unreachable=0    failed=0</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">TASK: [write /etc/ntp] ********************************************************<br>
ok: [c02]<br>
changed: [c01]</p>
<p dir="auto">NOTIFIED: [restart ntp] *******************************************************<br>
changed: [c01]<br>
changed: [c02]</p>
<p dir="auto">PLAY RECAP ********************************************************************<br>
c01                        : ok=3    changed=2    unreachable=0    failed=0<br>
c02                        : ok=3    changed=1    unreachable=0    failed=0</p>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.6.2</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Running from OS X 10.9.3<br>
Managing RHEL 6.5, Fedora 20</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">When a change is detected in a specific host handlers run on every host, even in ones without changes</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/drybjed/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/drybjed">@drybjed</a> confirmed this bug and told me it is not present in 1.6.0 and it is related to this <a href="https://github.com/ansible/ansible/issues/7446" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/7446/hovercard">issue</a> and <a href="https://github.com/ansible/ansible/commit/e36a8d466e5ace049a18334f9ee4c07cc44bfb91">commit</a></p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">Run a playbook like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- name: all hosts
  hosts: all
  user: root

  tasks:
    - name: foo
      copy: src=/tmp/foo.conf dest=/tmp/foo.conf owner=root group=root mode=0644
      notify:
        - restart ntpd
  handlers:
    - include: &quot;../../handlers/restart_services.yml&quot;"><pre class="notranslate"><code class="notranslate">
---
- name: all hosts
  hosts: all
  user: root

  tasks:
    - name: foo
      copy: src=/tmp/foo.conf dest=/tmp/foo.conf owner=root group=root mode=0644
      notify:
        - restart ntpd
  handlers:
    - include: "../../handlers/restart_services.yml"
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">handlers run only on notified hosts</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">handlers run on every host in the playbook, even in ones without changes:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [all hosts] **************************************************************

GATHERING FACTS *************************************************************** 
ok: [host1.domain]
ok: [host2.domain]
ok: [host3.domain]

TASK: [foo] ******************************************************************* 
ok: [host1.domain] =&gt; {&quot;changed&quot;: false, &quot;dest&quot;: &quot;/tmp/foo.conf&quot;, &quot;gid&quot;: 0, &quot;group&quot;: &quot;root&quot;, &quot;md5sum&quot;: &quot;d41d8cd98f00b204e9800998ecf8427e&quot;, &quot;mode&quot;: &quot;0644&quot;, &quot;owner&quot;: &quot;root&quot;, &quot;path&quot;: &quot;/tmp/foo.conf&quot;, &quot;secontext&quot;: &quot;unconfined_u:object_r:admin_home_t:s0&quot;, &quot;size&quot;: 0, &quot;state&quot;: &quot;file&quot;, &quot;uid&quot;: 0}
ok: [host2.domain] =&gt; {&quot;changed&quot;: false, &quot;dest&quot;: &quot;/tmp/foo.conf&quot;, &quot;gid&quot;: 0, &quot;group&quot;: &quot;root&quot;, &quot;md5sum&quot;: &quot;d41d8cd98f00b204e9800998ecf8427e&quot;, &quot;mode&quot;: &quot;0644&quot;, &quot;owner&quot;: &quot;root&quot;, &quot;path&quot;: &quot;/tmp/foo.conf&quot;, &quot;secontext&quot;: &quot;unconfined_u:object_r:admin_home_t:s0&quot;, &quot;size&quot;: 0, &quot;state&quot;: &quot;file&quot;, &quot;uid&quot;: 0}
changed: [host3.domain] =&gt; {&quot;changed&quot;: true, &quot;dest&quot;: &quot;/tmp/foo.conf&quot;, &quot;gid&quot;: 0, &quot;group&quot;: &quot;root&quot;, &quot;md5sum&quot;: &quot;d41d8cd98f00b204e9800998ecf8427e&quot;, &quot;mode&quot;: &quot;0644&quot;, &quot;owner&quot;: &quot;root&quot;, &quot;secontext&quot;: &quot;unconfined_u:object_r:admin_home_t:s0&quot;, &quot;size&quot;: 0, &quot;src&quot;:     &quot;/root/.ansible/tmp/ansible-tmp-1401171805.31-244401036446552/source&quot;, &quot;state&quot;: &quot;file&quot;, &quot;uid&quot;: 0}

NOTIFIED: [restart ntpd] ******************************************************
changed: [host1.domain] =&gt; {&quot;changed&quot;: true, &quot;item&quot;: &quot;&quot;, &quot;name&quot;: &quot;ntpd&quot;, &quot;state&quot;: &quot;started&quot;}
changed: [host2.domain] =&gt; {&quot;changed&quot;: true, &quot;item&quot;: &quot;&quot;, &quot;name&quot;: &quot;ntpd&quot;, &quot;state&quot;: &quot;started&quot;}
changed: [host3.domain] =&gt; {&quot;changed&quot;: true, &quot;item&quot;: &quot;&quot;, &quot;name&quot;: &quot;ntpd&quot;, &quot;state&quot;: &quot;started&quot;}

host2.domain   : ok=3    changed=1    unreachable=0    failed=0
host1.domain : ok=3    changed=1    unreachable=0    failed=0   
host3.domain : ok=3    changed=2    unreachable=0    failed=0  "><pre class="notranslate"><code class="notranslate">PLAY [all hosts] **************************************************************

GATHERING FACTS *************************************************************** 
ok: [host1.domain]
ok: [host2.domain]
ok: [host3.domain]

TASK: [foo] ******************************************************************* 
ok: [host1.domain] =&gt; {"changed": false, "dest": "/tmp/foo.conf", "gid": 0, "group": "root", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "mode": "0644", "owner": "root", "path": "/tmp/foo.conf", "secontext": "unconfined_u:object_r:admin_home_t:s0", "size": 0, "state": "file", "uid": 0}
ok: [host2.domain] =&gt; {"changed": false, "dest": "/tmp/foo.conf", "gid": 0, "group": "root", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "mode": "0644", "owner": "root", "path": "/tmp/foo.conf", "secontext": "unconfined_u:object_r:admin_home_t:s0", "size": 0, "state": "file", "uid": 0}
changed: [host3.domain] =&gt; {"changed": true, "dest": "/tmp/foo.conf", "gid": 0, "group": "root", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "mode": "0644", "owner": "root", "secontext": "unconfined_u:object_r:admin_home_t:s0", "size": 0, "src":     "/root/.ansible/tmp/ansible-tmp-1401171805.31-244401036446552/source", "state": "file", "uid": 0}

NOTIFIED: [restart ntpd] ******************************************************
changed: [host1.domain] =&gt; {"changed": true, "item": "", "name": "ntpd", "state": "started"}
changed: [host2.domain] =&gt; {"changed": true, "item": "", "name": "ntpd", "state": "started"}
changed: [host3.domain] =&gt; {"changed": true, "item": "", "name": "ntpd", "state": "started"}

host2.domain   : ok=3    changed=1    unreachable=0    failed=0
host1.domain : ok=3    changed=1    unreachable=0    failed=0   
host3.domain : ok=3    changed=2    unreachable=0    failed=0  
</code></pre></div>