diff --git a/group_vars/all b/group_vars/all index a63f5c60..7a5b0993 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,6 +1,7 @@ # General reset_files: false # Cleans up all CyMaIS files. It's necessary to run to whole playbook and not particial roles when using this function. verbose: false # Prints well formated debug information +test_run: false # Executes test routines instead of productive routines database_delay: "0" # Database delay to wait for the central database before continue tasks top_domain: "localhost" # Change this in inventory to your domain ip4_address: "127.0.0.1" # Change thie in inventory to the ip address of your server diff --git a/roles/docker-attendize/tasks/main.yml b/roles/docker-attendize/tasks/main.yml index 7fea90b4..ea001a88 100644 --- a/roles/docker-attendize/tasks/main.yml +++ b/roles/docker-attendize/tasks/main.yml @@ -2,12 +2,14 @@ - name: "include docker-compose-common.yml" include_tasks: docker-compose-common.yml -- name: receive {{ mail_interface_domain }} certificate - command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ mail_interface_domain }} - -- name: receive {{ domain }} certificate - command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ domain }} - +- name: "include tasks to receive attendize certbot certificate" + include_tasks: recieve-certbot-certificate.yml + vars: + domain: "{{ item }}" + loop: + - "{{ mail_interface_domain }}" + - "{{ domain }}" + - name: configure {{domain}}.conf template: src: roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 diff --git a/roles/nginx-domain-redirect/tasks/main.yml b/roles/nginx-domain-redirect/tasks/main.yml index 506c3acd..0dccac71 100644 --- a/roles/nginx-domain-redirect/tasks/main.yml +++ b/roles/nginx-domain-redirect/tasks/main.yml @@ -1,7 +1,8 @@ --- -- name: recieve redirect source certificates - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{item.source}} - loop: "{{domain_mappings}}" +- name: "include task receive certbot certificate" + include_tasks: recieve-certbot-certificate.yml + vars: + domain: "{{ domain }}" - name: configure nginx redirect configurations vars: diff --git a/tasks/recieve-certbot-certificate.yml b/tasks/recieve-certbot-certificate.yml index 77f063ee..c0bd9218 100644 --- a/tasks/recieve-certbot-certificate.yml +++ b/tasks/recieve-certbot-certificate.yml @@ -1,2 +1,5 @@ -- name: recieve certbot certificate for {{domain}} - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} \ No newline at end of file +- name: recieve certbot certificate for {{ domain }} + command: >- + certbot certonly --agree-tos --email {{ administrator_email }} + --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ domain }} + {{ '--test-cert' if test_run | bool else '' }} \ No newline at end of file