evoacme: install hooks in a loop

This commit is contained in:
Jérémy Lecour 2017-11-15 11:17:58 +01:00 committed by Jérémy Lecour
parent 6608f13421
commit 5c6c92ab69
3 changed files with 23 additions and 24 deletions

View file

@ -30,30 +30,6 @@
group: acme
state: directory
- name: "Search for reload_apache hook"
command: "find {{ evoacme_hooks_dir }} -type f \\( -name 'reload_apache' -o -name 'reload_apache.*' \\)"
check_mode: no
register: find_apache_hook
- name: "Copy reload_apache hook if missing"
copy:
src: "hooks/reload_apache"
dest: "{{ evoacme_hooks_dir }}/reload_apache"
mode: "0750"
when: find_apache_hook.stdout == ""
- name: "Search for reload_nginx hook"
command: "find {{ evoacme_hooks_dir }} -type f \\( -name 'reload_nginx' -o -name 'reload_nginx.*' \\)"
check_mode: no
register: find_nginx_hook
- name: "Copy reload_nginx hook if missing"
copy:
src: "hooks/reload_nginx"
dest: "{{ evoacme_hooks_dir }}/reload_nginx"
mode: "0750"
when: find_nginx_hook.stdout == ""
- name: Fix log dir's right
file:
path: "{{ evoacme_log_dir }}"

View file

@ -0,0 +1,14 @@
---
- name: "Search for {{ hook_name }} hook"
command: "find {{ evoacme_hooks_dir }} -type f \\( -name '{{ hook_name }}' -o -name '{{ hook_name }}.*' \\)"
check_mode: no
changed_when: False
register: _find_hook
- name: "Copy {{ hook_name }} hook if missing"
copy:
src: "hooks/{{ hook_name }}"
dest: "{{ evoacme_hooks_dir }}/{{ hook_name }}"
mode: "0750"
when: _find_hook.stdout == ""

View file

@ -9,6 +9,15 @@
- include: acme.yml
- include: evoacme_hook.yml
vars:
hook_name: "{{ item }}"
with_items:
- reload_apache
- reload_nginx
- reload_dovecot
- reload_postfix
- include: conf.yml
- include: scripts.yml