From a821a2f4054ac140969ddcd3872e4489d38053a6 Mon Sep 17 00:00:00 2001 From: Sebastian Fleer Date: Mon, 24 Jun 2024 10:59:31 +0200 Subject: [PATCH] feat(lego): make HTTP challenge port configurable --- roles/lego/defaults/main.yml | 1 + roles/lego/vars/main.yml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/roles/lego/defaults/main.yml b/roles/lego/defaults/main.yml index 53c8826..cdd3bce 100644 --- a/roles/lego/defaults/main.yml +++ b/roles/lego/defaults/main.yml @@ -60,6 +60,7 @@ lego_letsencrypt_environment: "staging" lego_challenge: type: "http" +lego_challenge_http_port: 80 lego_letsencrypt_servers: prod: "https://acme-v02.api.letsencrypt.org/directory" diff --git a/roles/lego/vars/main.yml b/roles/lego/vars/main.yml index d7dff75..90a9d90 100644 --- a/roles/lego/vars/main.yml +++ b/roles/lego/vars/main.yml @@ -2,9 +2,16 @@ lego_challenge_mergeable: command_parameters: global: "{'{{ lego_challenge.type }}': '{{ lego_challenge.provider | default('') }}'}" -lego_configuration_merged: >- - {{ lego_configuration_defaults | combine(lego_challenge_mergeable, recursive=True) - | combine(lego_configuration | default({}), recursive=True) }} +lego_challenge_http_mergeable: + command_parameters: + global: "{'http.port': ':{{ lego_challenge_http_port }}'}" +lego_configuration_merged: >-2 + {{ + lego_configuration_defaults + | combine(lego_challenge_mergeable, recursive=True) + | combine(lego_challenge_http_mergeable if lego_challenge.type == 'http' else {}, recursive=True) + | combine(lego_configuration | default({}), recursive=True) + }} # Build global command lego_command_domains: >-2