Fix race condition with certbot role needing nginx and vice versa

This commit is contained in:
Erik Stambaugh 2024-01-31 12:53:59 -08:00
parent a1a441f366
commit 57b7345a62
2 changed files with 32 additions and 13 deletions

View 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

View file

@ -19,7 +19,9 @@
template: template:
src: templates/docker-compose.yaml src: templates/docker-compose.yaml
dest: /srv/certbot/docker-compose.yaml dest: /srv/certbot/docker-compose.yaml
register: dockercompose notify:
- certbot up
- certbot restart
- name: nginx options - name: nginx options
copy: copy:
@ -40,7 +42,9 @@
# OCSP stapling # OCSP stapling
ssl_stapling on; ssl_stapling on;
ssl_stapling_verify on; ssl_stapling_verify on;
register: nginxconf notify:
- certbot up
- certbot restart
- name: create the dir for the cert if needed - name: create the dir for the cert if needed
@ -54,16 +58,18 @@
args: args:
chdir: /srv/certbot chdir: /srv/certbot
creates: "/srv/certbot/etc/live/{{domain_name}}/fullchain.pem" creates: "/srv/certbot/etc/live/{{domain_name}}/fullchain.pem"
register: mkcert notify:
- certbot up
- certbot restart
- name: launch certbot #- name: launch certbot
command: docker compose up -d # command: docker compose up -d
args: # args:
chdir: /srv/certbot # chdir: /srv/certbot
#
- name: restart certbot #- name: restart certbot
command: docker compose restart # command: docker compose restart
args: # args:
chdir: /srv/certbot # chdir: /srv/certbot
when: dockercompose.changed or nginxconf.changed or mkcert.changed # when: dockercompose.changed or nginxconf.changed or mkcert.changed