I probably have something structured wrong or it's something simple - but
I'm stuck trying to get handlers added to a playbook via include to fire.
The handlers from roles that are listed in the playbook fire correctly,
but the include ones do not. And the task with the notify has a changed:
true.
Running ansible-playbook 2.0.0 (last pull on 7/18) on SLES
Here's the playbook
---
# This Playbook deploys the components for the webserver
# Apache, consului and kibana
# setup and deploy apache
- hosts: webservers
become: yes
roles:
- role: common
- role: apache
- role: consului
- role: kibana
handlers:
- include: roles/consul/handlers/main.yml
- include: roles/consul-template/handlers/main.yml
I'm using consul and consul-template to hold the config variables for the
components. I push a change to a consul-template file and expect the
handler 'refresh consultemplate' to run, but it does not.
Here is the roles/consul-template/handlers/main.yml file
---
# file: roles/consul-template/handlers/main.yml
- name: refresh consultemplate
shell: 'kill -1 $(cat /var/run/consul-template.pid)'
- name: install consultemplate
command: /sbin/insserv -f consul-template
- name: restart consultemplate
service: name=consul-template state=restarted
And the task in the roles/kibana/tasks/main.yml with the notify
- name: Add consul-template ctmpl file
copy: src=kibana.ctmpl dest=/etc/consul-template/ctmpl/kibana.ctmpl
notify: refresh consultemplate
And the run
TASK [kibana : kibana : Add consul-template ctmpl file]
*************************
changed: [XXXXXX]
TASK [kibana : kibana : Add apache mod_proxy to connect to consul]
**************
changed: [XXXXXX]
RUNNING HANDLER [apache : restart apache]
***************************************
changed: [XXXXXX]
PLAY RECAP
**********************************************************************
XXXXXX : ok=29 changed=8 unreachable=0 failed=0
So the handler I have in roles/apache/handlers/main.yml works correctly.
It's just the include handlers where the associated role is not in the
playbook
Any help would be appreciated.
--
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/623d598c-98c3-468f-9ac6-9b7faef9496e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.