summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-11-27 18:18:59 +0100
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-11-27 18:19:58 +0100
commit9e3d30552284725ed845b077e4de7ae9c1f4a62e (patch)
tree979c1114cc48c5ccf3c4f5ff3e235e1b9e7338fe /roles
parentnginx: Make DH params optional (diff)
downloadansible-roles-master.tar.xz
acme: Add support to specify reload command per certificateHEADmaster
Diffstat (limited to 'roles')
-rw-r--r--roles/acme/tasks/main.yml5
-rw-r--r--roles/acme/templates/acme.j25
2 files changed, 8 insertions, 2 deletions
diff --git a/roles/acme/tasks/main.yml b/roles/acme/tasks/main.yml
index d9c1a0a..424beea 100644
--- a/roles/acme/tasks/main.yml
+++ b/roles/acme/tasks/main.yml
@@ -37,13 +37,14 @@
owner: root
group: root
mode: 0440
+ validate: visudo -c -f %s
- name: Issue certificates
become: yes
become_user: acme
- command: '.acme.sh/acme.sh --issue -d {{ item | join(" -d ") }} -w /home/acme/webroot/ --reloadcmd "sudo {{ acme_reload_cmd }}"'
+ command: '.acme.sh/acme.sh --issue -d {{ item.name | mandatory }}{% if item.alt is defined %} -d{% endif %} {{ item.alt | default([]) | join(" -d ") }} -w /home/acme/webroot/ --reloadcmd "sudo {{ item.reloadcmd | default(acme_reload_cmd) }}"'
args:
chdir: /home/acme
- creates: "/home/acme/.acme.sh/{{ item[0] }}/{{ item[0] }}.cer"
+ creates: "/home/acme/.acme.sh/{{ item.name | mandatory }}/{{ item.name }}.cer"
with_items:
- "{{ acme_issue_certs }}"
diff --git a/roles/acme/templates/acme.j2 b/roles/acme/templates/acme.j2
index dc61823..54f2bf0 100644
--- a/roles/acme/templates/acme.j2
+++ b/roles/acme/templates/acme.j2
@@ -1 +1,6 @@
acme ALL=(ALL) NOPASSWD: {{ acme_reload_cmd }}
+{% for item in acme_issue_certs %}
+{% if item.reloadcmd is defined %}
+acme ALL=(ALL) NOPASSWD: {{ item.reloadcmd }}
+{% endif %}
+{% endfor %}