summaryrefslogtreecommitdiffstats
path: root/roles/nginx/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx/tasks/main.yml')
-rw-r--r--roles/nginx/tasks/main.yml16
1 files changed, 13 insertions, 3 deletions
diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml
index 2ac852e..4d4b085 100644
--- a/roles/nginx/tasks/main.yml
+++ b/roles/nginx/tasks/main.yml
@@ -51,6 +51,7 @@
group: root
mode: 0644
with_items:
+ - acme.conf
- common.conf
- ssl-common.conf
- ssl-medium-common.conf
@@ -70,18 +71,27 @@
- restart nginx
when: stat_default.stat.exists and stat_default.stat.islnk == True
-- name: Deploy temporary default page (with our snippets etc)
+- name: Detect acme configuration on some vhost
+ shell: ls | grep -v default | while read LINE; do cat "$LINE" ; done | grep -q 'include snippets/acme.conf'
+ args:
+ chdir: /etc/nginx/sites-enabled
+ register: autodetect
+ changed_when: False
+ failed_when: False
+ when: nginx_deploy_default_config == True and nginx_enable_autodetection == True
+
+- name: Deploy default page (with our snippets etc)
copy:
src: default
## Do not deploy it as symlik
- ## This method keeps default config available, provides necessary definitions (.well-known)
- ## and the particular server ussually deletes /etc/nginx/sites-enabled/default
dest: /etc/nginx/sites-enabled/default
owner: root
group: root
mode: 0644
notify:
- restart nginx
+ when: (nginx_deploy_default_config == True and nginx_enable_autodetection == True and autodetect.rc != 0) or
+ (nginx_deploy_default_config == True and nginx_enable_autodetection == False)
- meta: flush_handlers