From 3171aa5ead3c7e91448d1896d4da76b60390108f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 24 Jun 2024 18:56:37 +0200 Subject: [PATCH] Make zerossl usage depend on having an api key --- roles/caddy/defaults/main.yml | 1 + roles/caddy/templates/config.json.j2 | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/roles/caddy/defaults/main.yml b/roles/caddy/defaults/main.yml index 378f819..338f58c 100644 --- a/roles/caddy/defaults/main.yml +++ b/roles/caddy/defaults/main.yml @@ -9,3 +9,4 @@ caddy_use_https: yes caddy_tls_use_staging: no # caddy_email: your@email.here +# caddy_zerossl_api_key: your-zerossl-key-here-its-free diff --git a/roles/caddy/templates/config.json.j2 b/roles/caddy/templates/config.json.j2 index b104a25..6a13848 100644 --- a/roles/caddy/templates/config.json.j2 +++ b/roles/caddy/templates/config.json.j2 @@ -51,17 +51,19 @@ {% if caddy_tls_use_staging is sameas true %} "ca": "https://acme-staging-v02.api.letsencrypt.org/directory", {% endif %} - {%- if caddy_email is not undefined and not none %} + {%- if caddy_email is not undefined and not none %} "email": "{{ caddy_email }}", {% endif %} "module": "acme" + {%- if caddy_zerossl_api_key is not undefined and not none %} }, { - {%- if caddy_email is not undefined and not none %} - "email": "{{ caddy_email }}", - {% endif %} + "api_key": "{{ caddy_zerossl_api_key }}", "module": "zerossl" } + {% else %} + } + {% endif %} ] } ]