nginx: support certificates for multiple domains

Uses `tls_domains` config context property from NetBox.
This commit is contained in:
Timotej Lazar 2024-11-15 11:25:50 +01:00
parent 554bf1f711
commit 4fba1b2d6d
2 changed files with 5 additions and 2 deletions

3
roles/nginx/README.md Normal file
View file

@ -0,0 +1,3 @@
Install nginx, set up generic HTTPS redirects and the .well-known directory.
Also acquire Let’s Encrypt certificates for domains listed in the `tls_domains` context property (or just for the primary IP `dns_domain` if `tls_domains` is not set).

View file

@ -26,8 +26,8 @@
- name: Get LE certificate - name: Get LE certificate
command: command:
cmd: certbot certonly --non-interactive --agree-tos --register-unsafely-without-email --webroot --webroot-path /srv/http -d {{ dns_name }} cmd: certbot certonly --non-interactive --agree-tos --register-unsafely-without-email --webroot --webroot-path /srv/http -d {{ tls_domains|default([dns_name])|join(',') }}
creates: '/etc/letsencrypt/renewal/{{ dns_name }}.conf' creates: '/etc/letsencrypt/renewal/{{ tls_domains|default([dns_name])|first }}.conf'
- name: Install certificate renewal deployment hook - name: Install certificate renewal deployment hook
copy: copy: