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

@ -11,7 +11,7 @@ upstream {{ item.upstream.name }} {
{% endif %}
{% for server in item.servers %}
server {
listen {{ server.port }} {{ 'ssl' if server.tls is defined and server.tls else '' }};
listen {{ server.port }}{{ ' ssl' if server.tls is defined and server.tls else '' }};
server_name {{ server.server_name }};
{% if server.tls is defined and server.tls %}
@ -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 %}