The other possibility is there is a "creates=" or "removes=" on a handler
that used a command/shell module.


On Tue, Feb 18, 2014 at 7:22 AM, Michael DeHaan <mich...@ansible.com> wrote:

> Given you have a "when" above, there's a 99.99999% chance that's what's
> happening.
>
> If you tag a role with "when", all the tasks in it are applied with the
> same condition.
>
> None of the tasks would fire, or the handler.
>
> If you want to define a common handler, don't define it with a "when"
> condition.
>
> It may be that you are overriding a handler with the same name in one of
> those roles.
>
>
>
>
> On Tue, Feb 18, 2014 at 3:42 AM, Dan C <dco...@gmail.com> wrote:
>
>> I'm having some trouble having a handler executed. It is notified but
>> skipped. Is there any particular reason why a handler is notified but yet
>> skipped? I mean, from my point of view, if a handler is notified means
>> something changed and it needs to be notified and executed no matter what
>> still if it is only executed once at the end of the play, but why should it
>> ever be skipped?
>>
>> I am using ansible 1.4.3 on a ScientificLinux 6.5 .
>>
>> I'm using conditional roles and the same handler exist in previous
>> skipped roles:
>>
>> *- hosts: all*
>> *  roles:*
>> *    - id_target*
>> *    - common*
>> *    - { role: nginx-install, when: var == '2' }*
>> *    - { role: nginx-config, when: varp == '2' }*
>> *    - { role: kibana-central, when: var == '3' }*
>> *    - { role: elasticsearch-install, when: var == '1' }*
>> *    - { role: elasticsearch-config, when: var == '1' }*
>> *    - logstash-base-shippers*
>>
>> The role "elasticsearch-config" have a handler to restart elasticsearch.
>> While running the play "var" == 1, so at the configuration change the
>> handler should be notified, and it is, and applied , but it is not.
>> The same handler exist on the roles "kibana-central" , which is skipped
>> and "elasticsearch-install".
>>
>> This is what I get:
>> *[...]*
>>
>> *TASK: [java-install | Install OpenJDK]
>> **************************************** *
>> *changed: [localhost]*
>>
>> *TASK: [elasticsearch-install | Install Elasticsearch]
>> ************************* *
>> *changed: [localhost]*
>>
>>
>> *TASK: [elasticsearch-install | Ensure ElasticSearch is running]
>> ***************  *
>> *ok: [localhost]*
>>
>> *TASK: [elasticsearch-config | Copy elasticsearch.yml]
>> ************************* *
>> *changed: [localhost]*
>>
>> *TASK: [java-install | Install OpenJDK]
>> **************************************** *
>> *ok: [localhost]*
>>
>> *TASK: [logstash-install | Install Logstash]
>> *********************************** *
>> *changed: [localhost]*
>>
>> *[...]*
>>
>> *NOTIFIED: [elasticsearch-install | restart elasticsearch]
>> ********************* *
>> *skipping: [localhost]*
>>
>> *NOTIFIED: [supervisor-install | restart supervisord]
>> ************************** *
>> *changed: [localhost]*
>>
>> *NOTIFIED: [logstash-base-shippers | reload supervisord]
>> *********************** *
>> *changed: [localhost]*
>>
>> *PLAY RECAP
>> ******************************************************************** *
>> *localhost                  : ok=38   changed=21   unreachable=0
>>  failed=0   *
>>
>>
>>
>> Note:
>> *NOTIFIED: [elasticsearch-install | restart elasticsearch]
>> ********************* *
>> *skipping: [localhost]*
>>
>> Thanks!
>>
>> --
>> 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-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to