diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2019-03-06 00:07:47 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2019-03-06 00:07:47 -0500 |
| commit | d20fff93329f2bf7b4d19705c7598cedc2c924ac (patch) | |
| tree | 403198a6a2244d88d707b1fe1a2228ac22d33554 | |
| parent | 7b977aed7f40ccd866a51057db2fac2ca4d3777e (diff) | |
| download | nginx-d20fff93329f2bf7b4d19705c7598cedc2c924ac.tar.gz nginx-d20fff93329f2bf7b4d19705c7598cedc2c924ac.tar.xz | |
Load custom nginx templates if needed. Include acme-challenge on default vhost
| -rw-r--r-- | defaults/main.yml | 5 | ||||
| -rw-r--r-- | tasks/main.yml | 11 | ||||
| -rw-r--r-- | templates/nginx/acme-challenge | 3 | ||||
| -rw-r--r-- | templates/nginx/nginx.conf | 2 |
4 files changed, 20 insertions, 1 deletions
diff --git a/defaults/main.yml b/defaults/main.yml index 8778182..ca65bc8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,3 +13,8 @@ nginx_conf_group: adm nginx_acl_block: "" nginx_conf_dir: "/etc/nginx" + + +# If "True" it will template out {{ansible_hostname}}/nginx/nginx.conf instead +# of nginx/nginx.conf +nginx_custom_template: False diff --git a/tasks/main.yml b/tasks/main.yml index ab06c87..3ee74e2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,17 @@ owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" + when: not nginx_custom_template + notify: + - Restart Nginx +- name: Install custom 'nginx.conf' + template: + src: "{{ansible_hostname}}/nginx/nginx.conf" + dest: "{{nginx_conf_dir}}/nginx.conf" + owner: "{{nginx_conf_owner}}" + group: "{{nginx_conf_group}}" + mode: "{{nginx_conf_file_mode}}" + when: nginx_custom_template notify: - Restart Nginx - name: Install Other Nginx templates diff --git a/templates/nginx/acme-challenge b/templates/nginx/acme-challenge index 934999f..fad9cad 100644 --- a/templates/nginx/acme-challenge +++ b/templates/nginx/acme-challenge @@ -1,4 +1,5 @@ location /.well-known/acme-challenge { # This works for acmetool. If using letsencrypt change 'alias' to 'root' - alias /var/lib/acme-challenge; + alias /var/run/acme/acme-challenge/; + # alias /var/lib/acme-challenge; } diff --git a/templates/nginx/nginx.conf b/templates/nginx/nginx.conf index 3bf546f..eb622d5 100644 --- a/templates/nginx/nginx.conf +++ b/templates/nginx/nginx.conf @@ -24,6 +24,8 @@ http { listen [::]:80; server_name localhost; + include acme-challenge; + location / { root /usr/share/nginx/html; index index.html index.htm; |
