Thanks Brian,

Is there a minimum version for the "when" statment to work with handlers?
The ansible version I am using for this test is 1.7.2

I have:

# file: roles/beaver-configure/handlers/main.yml
- name: restart beaver
  service: name=beaver.sh state=restarted
  when: flag_not_restart is not defined

# file: roles/beaver-configure/tasks/main.yml
- name: Copy conf beaver
  template: src=../templates/conf.j2 dest=/etc/beaver/conf group=root 
owner=root mode=0644
  notify: restart beaver
- name: Start a enable beaver
  service: name=beaver.sh enabled=yes state=started 


I call an ansible playbook which calls the beaver role with:
/usr/local/bin/ansible-playbook /tmp/ansible-local/php.yml --extra-vars 
'flag_not_restart=1' -c local -i /tmp/ansible-local/localhost.inv

If I debug the "flag_not_restart" I can see it exist and is "1".
And yet the "restart beaver" handler is called and executed.

So, am I doing something wrong?


El domingo, 7 de junio de 2015, 23:47:35 (UTC+2), Brian Coca escribió:
>
> handlers are not affected by tags in general, but they should be 
> affected by when: 
>
> -- 
> Brian Coca 
>

-- 
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/89556230-da00-4320-b7d6-db3c238d200a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to