diff options
author | 2016-10-18 14:58:26 +0200 | |
---|---|---|
committer | 2016-10-18 17:13:59 +0200 | |
commit | 98081e863591d4f43447184fa69acc9f43d9ba63 (patch) | |
tree | 99e18487138431438902dd3246ce492e6af845da /roles/nginx/tasks | |
parent | nginx: Fix conditional that deletes default config (diff) | |
download | ansible-roles-98081e863591d4f43447184fa69acc9f43d9ba63.tar.xz |
nginx: Provide new mechanism for default page manipulation
Important changes:
- The well-known path is moved to the separate snippet acme.conf
- It is possible to disable default page
- The autodetection mechanism for default page is provided
Diffstat (limited to 'roles/nginx/tasks')
-rw-r--r-- | roles/nginx/tasks/main.yml | 16 |
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 |