fix some templating issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-07-18 00:16:24 +02:00
parent 853d645ce9
commit bd9efe2939
3 changed files with 7 additions and 11 deletions

View File

@ -93,9 +93,9 @@ nginx_vhosts_dir: /var/www/vhosts
nginx_vhosts_default:
- file: default
server:
servers:
- port: 80
server_name: "{{ ansible_hostname }}"
server_name: "{{ ansible_fqdn }}"
locations:
- match: /
root: /var/www/vhosts/default

View File

@ -122,9 +122,7 @@
owner: root
group: root
mode: 0640
loop:
- nginx_vhosts_default
- nginx_vhosts_extra
loop: "{{ nginx_vhosts_default + nginx_vhosts_extra }}"
loop_control:
label: "{{ item.file }}"
notify: __nginx_reload
@ -133,10 +131,8 @@
file:
src: "/etc/nginx/sites-available/{{ item.file }}"
dest: "/etc/nginx/sites-enabled/{{ item.file }}"
state: "{{ 'link' when item.state == 'enabled' else 'absent' }}"
loop:
- nginx_vhosts_default
- nginx_vhosts_extra
state: "{{ 'link' if item.enabled | default(True) | bool else 'absent' }}"
loop: "{{ nginx_vhosts_default + nginx_vhosts_extra }}"
loop_control:
label: "{{ item.file }}"
notify: __nginx_reload

View File

@ -29,7 +29,7 @@ server {
client_max_body_size {{ server.client_max_body_size }};
{% endif %}
{% for location in server.locations %}
location {{ location.match }}
location {{ location.match }} {
{% if location.root is defined and location.root %}
root {{ location.root }};
{% endif %}