From 7a78243d5d3b31f56af2aeb633a655639ff72795 Mon Sep 17 00:00:00 2001 From: AnsibleGuy Date: Sun, 6 Feb 2022 21:40:26 +0100 Subject: [PATCH] updated config check --- tasks/debian/letsencrypt/main.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tasks/debian/letsencrypt/main.yml b/tasks/debian/letsencrypt/main.yml index 2146af1..f7bc25a 100644 --- a/tasks/debian/letsencrypt/main.yml +++ b/tasks/debian/letsencrypt/main.yml @@ -1,19 +1,12 @@ --- - name: Certificates | Debian | LetsEncrypt Certbot | Checking config - ansible.builtin.fail: - msg: "The required configuration was not provided! - Needed: 'certs.letsencrypt.certs', 'certs.letsencrypt.service', - 'certs.letsencrypt.email or certs.letsencrypt.email.certs.email'" - when: > - CERT_CONFIG.letsencrypt.certs | length == 0 or - CERT_CONFIG.letsencrypt.service is none | default(none, true) or - (CERT_CONFIG.letsencrypt.email | default(none, true) is none and not CERT_CONFIG.letsencrypt.certs|check_email) - -- name: Certificates | Debian | LetsEncrypt Certbot | Checking service - ansible.builtin.fail: - msg: "You need to supply a supported LetsEncrypt Certbot service to use! (apache/nginx)" - when: "CERT_CONFIG.letsencrypt.service | default(none, true) is none or CERT_CONFIG.letsencrypt.service not in ['apache', 'nginx']" + ansible.builtin.assert: + that: + - CERT_CONFIG.letsencrypt.certs | length > 0 + - CERT_CONFIG.letsencrypt.service | default(none, true) is not none + - CERT_CONFIG.letsencrypt.email | default(none, true) is not none or CERT_CONFIG.letsencrypt.certs|check_email + - "CERT_CONFIG.letsencrypt.service in ['apache', 'nginx']" - name: Certificates | Debian | LetsEncrypt Certbot | Configure for Apache2 ansible.builtin.import_tasks: apache.yml