Fix race condition with certbot role needing nginx and vice versa
This commit is contained in:
parent
a1a441f366
commit
57b7345a62
2 changed files with 32 additions and 13 deletions
13
ansible/roles/certbot/handlers/main.yaml
Normal file
13
ansible/roles/certbot/handlers/main.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
|
||||
- name: certbot up
|
||||
command: docker compose up -d
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
|
||||
|
||||
- name: certbot restart
|
||||
command: docker compose restart
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
|
|
@ -19,7 +19,9 @@
|
|||
template:
|
||||
src: templates/docker-compose.yaml
|
||||
dest: /srv/certbot/docker-compose.yaml
|
||||
register: dockercompose
|
||||
notify:
|
||||
- certbot up
|
||||
- certbot restart
|
||||
|
||||
- name: nginx options
|
||||
copy:
|
||||
|
@ -40,7 +42,9 @@
|
|||
# OCSP stapling
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
register: nginxconf
|
||||
notify:
|
||||
- certbot up
|
||||
- certbot restart
|
||||
|
||||
|
||||
- name: create the dir for the cert if needed
|
||||
|
@ -54,16 +58,18 @@
|
|||
args:
|
||||
chdir: /srv/certbot
|
||||
creates: "/srv/certbot/etc/live/{{domain_name}}/fullchain.pem"
|
||||
register: mkcert
|
||||
notify:
|
||||
- certbot up
|
||||
- certbot restart
|
||||
|
||||
- name: launch certbot
|
||||
command: docker compose up -d
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
|
||||
- name: restart certbot
|
||||
command: docker compose restart
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
when: dockercompose.changed or nginxconf.changed or mkcert.changed
|
||||
#- name: launch certbot
|
||||
# command: docker compose up -d
|
||||
# args:
|
||||
# chdir: /srv/certbot
|
||||
#
|
||||
#- name: restart certbot
|
||||
# command: docker compose restart
|
||||
# args:
|
||||
# chdir: /srv/certbot
|
||||
# when: dockercompose.changed or nginxconf.changed or mkcert.changed
|
||||
|
||||
|
|
Loading…
Reference in a new issue