---# 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
---# 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
- name: Add consul-template ctmpl file copy: src=kibana.ctmpl dest=/etc/consul-template/ctmpl/kibana.ctmpl notify: refresh consultemplate
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
roles/
ansible_galaxy_apache_role/
handlers/main.yml <--- has restart apache handler
my_apache_role/
tasks/main.yml <-- includes ansible_galaxy_apache_role, and calls its restart apache handler
roles:
- my_apache_role
RUNNING HANDLER [comm_nginx : print_report_handler] ********************************************************************************************************************************************************
.........
ok: [demo_nginx_1_host] => {
"msg": "The test is successful."
}
META: ran handlers
META: ran handlers