Please try things in 1.6.10, which is the latest version, and contains security updates that you will want.
Per the changelog, this was fixed in 1.6.3 https://github.com/ansible/ansible/blob/devel/CHANGELOG.md On Thu, Jul 31, 2014 at 4:37 AM, Oliver Laumann <[email protected]> wrote: > Hello list, > > I'm trying to roll out some mysql configuration files. The playbook itself > is not the problem. My problem are the handlers that are for every given > host and not only for the changed hosts. > > I've got three servers that got some roles. The roles will be determinated > by some "local gathering fact" script. If only one configuration file was > changed by the ansible rollout the playbook will call the handler on all 3 > hosts. > > But first things first, here's the playbook: > > --- > - hosts: > - "*.c-1.home" > - "*.c-2.home" > tasks: > - name: Gather our facts > action: local_gathering > > - name: copy file to '/etc/mysql/conf.d/optimizer_switch.cnf' > copy: src=roles/role-db/files/mysql-5.6/optimizer_switch.cnf > dest=/etc/mysql/conf.d owner=root group=root mode=0644 > when: mysql.version == '5.6' and roles.db == '1' > notify: restart mysql > > # I've replaced the handler with some debugging output for testing > purposes. > handlers: > - name: restart mysql > debug: msg="restart mysql for {{ ansible_hostname}}" > > Here's the call: > > % ansible-playbook -i ansible.hosts mysql.yml > > And here's the output: > > PLAY [*.c-2.home;*.c-1.home] ************************** > > GATHERING FACTS > *************************************************************** > ok: [srv.c-1.home] > ok: [db.c-2.home] > ok: [app.c-2.home] > > TASK: [Gather our facts] > ****************************************************** > ok: [db.c-2.home] > ok: [app.c-2.home] > ok: [srv.c-1.home] > > TASK: [copy file to '/etc/mysql/conf.d/optimizer_switch.cnf'] > ***************** > skipping: [app.c-2.home] > ok: [db.c-2.home] > changed: [srv.c-1.home] > > NOTIFIED: [restart mysql] > ***************************************************** > ok: [app.c-2.home] => { > "msg": "restart mysql for app" > } > ok: [db.c-2.home] => { > "msg": "restart mysql for db" > } > ok: [srv.c-1.home] => { > "msg": "restart mysql for srv" > } > > PLAY RECAP > ******************************************************************** > app.c-2.home : ok=3 changed=0 unreachable=0 failed=0 > db.c-2.home : ok=4 changed=0 unreachable=0 failed=0 > srv.c-1.home : ok=4 changed=1 unreachable=0 failed=0 > > As you can see only on the "db" the configuration files were changed but > the handler was called > on all three servers. Why is that so? How can I change the playbook so the > handler will be called only > on the "changed" hosts. > > I'm using ansible 1.6.2 > > -- > 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/16b0b36f-e787-416c-97ff-f422aca0e6de%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/16b0b36f-e787-416c-97ff-f422aca0e6de%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgzCT_C_6whV0DZ9esq%2Bprs6d4pLJSBNbatYLzt7FkX_3A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
