Commit 6dd16db6 authored by nanahira's avatar nanahira

handlers

parent d8e54d3b
---
- name: restart docker services
docker_compose:
project_src: '{{handler.path}}'
restarted: yes
services: '{{handler.services}}'
---
- name: restart nginx
become: true
shell: 'nginx -t && nginx -s reload'
---
- name: shell
become: true
shell: '{{handler.command}}'
args:
chdir: '{{handler.path}}'
---
- name: restart systemd
become: true
systemd:
name: '{{handler.name}}'
state: restarted
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
checksum: yes checksum: yes
archive: no archive: no
perms: yes perms: yes
notify: handler
- name: templates directory - name: templates directory
file: file:
path: '{{ service_path }}/templates' path: '{{ service_path }}/templates'
...@@ -35,9 +36,16 @@ ...@@ -35,9 +36,16 @@
owner: '{{ ansible_user_id }}' owner: '{{ ansible_user_id }}'
group: '{{ ansible_user_id }}' group: '{{ ansible_user_id }}'
follow: yes follow: yes
notify: handler
- name: docker-compose up -d - name: docker-compose up -d
docker_compose: docker_compose:
project_src: '{{ service_path }}' project_src: '{{ service_path }}'
remove_orphans: true remove_orphans: true
build: '{{build}}' build: '{{build}}'
pull: '{{pull}}' pull: '{{pull}}'
handlers:
- name: handle
include_tasks: 'handlers/{{item.type}}.yaml'
vars:
handler: '{{item}}'
with_items: '{{handlers}}'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment