Fix certbot playbook not running on fresh install
This commit is contained in:
parent
5124a8035f
commit
fa236fa0b6
1 changed files with 17 additions and 8 deletions
|
@ -48,20 +48,29 @@
|
|||
ssl_stapling_verify on;
|
||||
|
||||
- name: create the dir for the cert if needed
|
||||
command: "docker exec -t certbot mkdir -p /etc/letsencrypt/live/{{domain_name}}/"
|
||||
args:
|
||||
creates: "/srv/certbot/etc/live/{{domain_name}}"
|
||||
|
||||
- name: seed a fake cert if needed
|
||||
command: "docker exec -t certbot openssl req -nodes -new -x509 -subj '/CN=localhost' -out /etc/letsencrypt/live/{{domain_name}}/fullchain.pem -keyout /etc/letsencrypt/live/{{domain_name}}/privkey.pem"
|
||||
args:
|
||||
creates: "/srv/certbot/etc/live/{{domain_name}}/fullchain.pem"
|
||||
file:
|
||||
path: "/srv/certbot/etc/live/{{domain_name}}"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
- name: launch certbot
|
||||
command: docker compose up -d
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
|
||||
- name: seed a fake cert if needed
|
||||
command: "docker exec -t certbot openssl req -nodes -new -x509 -subj '/CN=localhost' -out /etc/letsencrypt/live/{{domain_name}}/fullchain.pem -keyout /etc/letsencrypt/live/{{domain_name}}/privkey.pem"
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
creates: "/srv/certbot/etc/live/{{domain_name}}/fullchain.pem"
|
||||
register: mkcert
|
||||
|
||||
- name: restart certbot
|
||||
command: docker compose restart
|
||||
args:
|
||||
chdir: /srv/certbot
|
||||
when: mkcert.changed
|
||||
|
||||
- name: restart certbot
|
||||
command: docker compose restart
|
||||
args:
|
||||
|
|
Loading…
Reference in a new issue