733122f0df
This change proposes calling a handler each time a certificate is created/updated. The handler name is based on the name of the certificate given in the letsencrypt_certs variable, as described in the role documentation. Because Ansible considers calling a handler with no listeners an error this means each letsencrypt user will need to provide a handler. One simple option illustrated here is just to produce a stamp file. This can facilitate cross-playbook and even cross-orchestration-tool communication. For example, puppet or other ansible playbooks can detect this stamp file and schedule their reloads, etc. then remove the stamp file. It is conceivable more complex listeners could be setup via other roles, etc. should the need arise. A test is added to make sure the stamp file is created for the letsencrypt test hosts, which are always generating a new certificate in the gate test. Change-Id: I4e0609c4751643d6e0c8d9eaa38f184e0ce5452e
15 lines
546 B
YAML
15 lines
546 B
YAML
- name: 'Build arguments for letsencrypt acme.sh driver for: {{ item.key }}'
|
|
set_fact:
|
|
acme_args: '"{% for domain in item.value %}-d {{ domain }} {% endfor %}"'
|
|
|
|
- name: 'Run acme.sh driver for {{ item.key }} certificate issue'
|
|
shell:
|
|
cmd: |
|
|
/opt/acme.sh/driver.sh {{ 'selfsign' if letsencrypt_self_sign_only else 'renew' }} {{ acme_args }}
|
|
args:
|
|
chdir: /opt/acme.sh/
|
|
environment:
|
|
LETSENCRYPT_STAGING: '{{ "1" if letsencrypt_use_staging else "0" }}'
|
|
notify: 'letsencrypt updated {{ item.key }}'
|
|
|
|
# Keys generated! |