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: I4e0609c4751643d6e0c8d9eaa38f184e0ce5452echanges/01/652801/15
parent
8baf6cabd3
commit
733122f0df
@ -1,4 +1,4 @@
|
||||
letsencrypt_certs:
|
||||
main:
|
||||
graphite01-main:
|
||||
- graphite01.opendev.org
|
||||
- graphite.opendev.org
|
||||
|
@ -0,0 +1,32 @@
|
||||
# Handlers for "letsencrypt update {{ key }}" events
|
||||
#
|
||||
# Note that because Ansible requires every called handler to have a
|
||||
# listener, every host will need to provide a handler somehow.
|
||||
#
|
||||
# NOTE(ianw): as at 04/2019 it seems that something like
|
||||
#
|
||||
# listen: letsencrypt updated letsencrypt01-main-service
|
||||
#
|
||||
# doesn't actually register the handler. May be a bug or a feature to
|
||||
# do with import_tasks; currently unsure.
|
||||
|
||||
- name: letsencrypt updated graphite01-main
|
||||
import_tasks: touch_file.yaml
|
||||
vars:
|
||||
touch_file: '/tmp/letsencrypt-graphite01-main.stamp'
|
||||
|
||||
# Gate testing hosts:
|
||||
- name: letsencrypt updated letsencrypt01-main-service
|
||||
import_tasks: touch_file.yaml
|
||||
vars:
|
||||
touch_file: '/tmp/letsencrypt01-main-service.stamp'
|
||||
|
||||
- name: letsencrypt updated letsencrypt01-other-service
|
||||
import_tasks: touch_file.yaml
|
||||
vars:
|
||||
touch_file: '/tmp/letsencrypt01-other-service.stamp'
|
||||
|
||||
- name: letsencrypt updated letsencrypt02-main-service
|
||||
import_tasks: touch_file.yaml
|
||||
vars:
|
||||
touch_file: '/tmp/letsencrypt02-main-service.stamp'
|
@ -0,0 +1,5 @@
|
||||
- name: 'Touch {{ touch_file }}'
|
||||
file:
|
||||
path: '{{ touch_file }}'
|
||||
state: touch
|
||||
|
@ -1,7 +1,7 @@
|
||||
letsencrypt_certs:
|
||||
main:
|
||||
letsencrypt01-main-service:
|
||||
- letsencrypt01.opendev.org
|
||||
- letsencrypt.opendev.org
|
||||
- alias.opendev.org
|
||||
secondary:
|
||||
letsencrypt01-other-service:
|
||||
- someotherservice.opendev.org
|
@ -1,4 +1,4 @@
|
||||
letsencrypt_certs:
|
||||
main:
|
||||
letsencrypt02-main-service:
|
||||
- letsencrypt02.opendev.org
|
||||
- letsencrypt.opendev.org
|
||||
|
Loading…
Reference in new issue