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!