From 2a27b91ab08a01d1360868ee252e9916185fb128 Mon Sep 17 00:00:00 2001 From: Nicolas KAROLAK <nicolas@karolak.fr> Date: Fri, 10 Apr 2020 08:23:10 +0000 Subject: [PATCH] syntax update --- roles/letsencrypt/tasks/main.yml | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/roles/letsencrypt/tasks/main.yml b/roles/letsencrypt/tasks/main.yml index a1dedd4a..33ef398b 100644 --- a/roles/letsencrypt/tasks/main.yml +++ b/roles/letsencrypt/tasks/main.yml @@ -5,17 +5,16 @@ force_apt_get: true install_recommends: false name: certbot - state: present - name: get all server_name values when: letsencrypt_domains == [] + changed_when: false register: letsencryt_nginx_output - shell: | - set -o pipefail - nginx -T 2>&1 | grep -v localhost | grep -P '^\s+server_name\s+.*;$' | sed -r 's/\s+server_name\s+(.*);/\1/' | uniq - args: + shell: executable: /bin/bash - changed_when: false + cmd: | + set -o pipefail + nginx -T 2>&1 | grep -v localhost | grep -P '^\s+server_name\s+.*;$' | sed -r 's/\s+server_name\s+(.*);/\1/' | uniq - name: save result as list when: letsencrypt_domains == [] @@ -66,13 +65,14 @@ - letsencrypt_save_list is changed register: letsencrypt_dry_run ignore_errors: true - command: | - certbot certonly \ - --dry-run \ - -n --agree-tos -m {{ letsencrypt_email }} \ - --webroot -w {{ letsencrypt_webroot }} \ - --expand \ - -d {{ letsencrypt_domains | join(',') }} + command: + cmd: | + certbot certonly \ + --dry-run \ + -n --agree-tos -m {{ letsencrypt_email }} \ + --webroot -w {{ letsencrypt_webroot }} \ + --expand \ + -d {{ letsencrypt_domains | join(',') }} - name: remove domains list file in case of failure when: letsencrypt_dry_run is failed @@ -90,13 +90,14 @@ - letsencrypt_domains != [] - letsencrypt_save_list is changed - letsencrypt_dry_run is succeeded - command: | - certbot certonly \ - {% if letsencrypt_testing %}--staging{% endif %} \ - -n --agree-tos -m {{ letsencrypt_email }} \ - --webroot -w {{ letsencrypt_webroot }} \ - --expand \ - -d {{ letsencrypt_domains | join(',') }} + command: + cmd: | + certbot certonly \ + {% if letsencrypt_testing %}--staging{% endif %} \ + -n --agree-tos -m {{ letsencrypt_email }} \ + --webroot -w {{ letsencrypt_webroot }} \ + --expand \ + -d {{ letsencrypt_domains | join(',') }} - name: update nginx certificate configuration when: -- GitLab