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: nginx_vhosts_default:
- file: default - file: default
server: servers:
- port: 80 - port: 80
server_name: "{{ ansible_hostname }}" server_name: "{{ ansible_fqdn }}"
locations: locations:
- match: / - match: /
root: /var/www/vhosts/default root: /var/www/vhosts/default

View File

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

View File

@ -11,7 +11,7 @@ upstream {{ item.upstream.name }} {
{% endif %} {% endif %}
{% for server in item.servers %} {% for server in item.servers %}
server { 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 }}; server_name {{ server.server_name }};
{% if server.tls is defined and server.tls %} {% if server.tls is defined and server.tls %}
@ -29,7 +29,7 @@ server {
client_max_body_size {{ server.client_max_body_size }}; client_max_body_size {{ server.client_max_body_size }};
{% endif %} {% endif %}
{% for location in server.locations %} {% for location in server.locations %}
location {{ location.match }} location {{ location.match }} {
{% if location.root is defined and location.root %} {% if location.root is defined and location.root %}
root {{ location.root }}; root {{ location.root }};
{% endif %} {% endif %}