Fixed an error with overwriting certbot certs.
authorLuke Hoersten <luke@hoersten.org>
Thu, 29 May 2025 20:01:29 -0500
changeset 242 e7083ad5c365
parent 241 a176be2cd1b3
child 243 f3f30ba5580e
Fixed an error with overwriting certbot certs.
certbot-dns-cloudflare/tasks/main.yaml
prosody/files/prosody.sh
prosody/tasks/main.yaml
prosody/templates/prosody.sh.j2
--- a/certbot-dns-cloudflare/tasks/main.yaml	Wed May 28 19:24:44 2025 -0500
+++ b/certbot-dns-cloudflare/tasks/main.yaml	Thu May 29 20:01:29 2025 -0500
@@ -30,11 +30,11 @@
 
 - name: check if cert exists
   become: yes
-  stat: path="/etc/letsencrypt/live/{{certbot_dns_cloudflare_domain}}-0001/cert.pem"
+  stat: path="/etc/letsencrypt/live/{{certbot_dns_cloudflare_domain}}/cert.pem"
   register: cert
 
 - name: run certbot
   become: yes
-  command: "certbot certonly -n --agree-tos --email {{certbot_dns_cloudflare_email}} --dns-cloudflare --dns-cloudflare-credentials /etc/letsencrypt/cred.conf -d {{certbot_dns_cloudflare_domain}} -d \"*.{{certbot_dns_cloudflare_domain}}\""
+  command: "certbot certonly -n --agree-tos --email {{certbot_dns_cloudflare_email}} --dns-cloudflare --dns-cloudflare-credentials /etc/letsencrypt/cred.conf --cert-name {{certbot_dns_cloudflare_domain}} -d {{certbot_dns_cloudflare_domain}} -d \"*.{{certbot_dns_cloudflare_domain}}\""
   when: not cert.stat.exists
   changed_when: false
--- a/prosody/files/prosody.sh	Wed May 28 19:24:44 2025 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#! /bin/bash
-
-prosodyctl --root cert import nth.io /etc/letsencrypt/live/nth.io-0001/fullchain.pem
--- a/prosody/tasks/main.yaml	Wed May 28 19:24:44 2025 -0500
+++ b/prosody/tasks/main.yaml	Thu May 29 20:01:29 2025 -0500
@@ -22,8 +22,8 @@
 
 - name: install letsencrypt ssl deploy hook
   become: yes
-  copy:
-    src: "prosody.sh"
+  template:
+    src: "prosody.sh.j2"
     dest: "/etc/letsencrypt/renewal-hooks/deploy/prosody.sh"
     mode: "0755"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prosody/templates/prosody.sh.j2	Thu May 29 20:01:29 2025 -0500
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+prosodyctl --root cert import {{prosody_vhost}} /etc/letsencrypt/live/{{prosody_vhost}}/fullchain.pem