Fix regression (merge?): filename for vhosts

pull/22/head
Emilien Mantel 2016-03-09 11:15:37 +01:00
parent 078c3420e1
commit 7cc44bc009
1 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,10 @@
--- ---
- name: FAIL | Check filenames
fail: msg="Forbidden keyword default on vhost {{ item.name if item.name is string else item.name[0] }}"
when: item.filename is defined and item.filename == 'default'
with_items: nginx_vhosts
- name: FAIL | Check vhost and SSL/TLS support - name: FAIL | Check vhost and SSL/TLS support
fail: msg="Missmatch configuration for vhost {{ item.name if item.name is string else item.name[0] }}" fail: msg="Missmatch configuration for vhost {{ item.name if item.name is string else item.name[0] }}"
when: > when: >
@ -30,21 +35,21 @@
- name: TEMPLATE | Create vhosts - name: TEMPLATE | Create vhosts
template: > template: >
src=etc/nginx/sites-available/{{ item.template if item.redirect_to is not defined else '_redirect' }}.j2 src=etc/nginx/sites-available/{{ item.template if item.redirect_to is not defined else '_redirect' }}.j2
dest={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }} dest={{ nginx_etc_dir }}/sites-available/{{ item.filename | default(item.name if item.name is string else item.name[0]) }}
with_items: "{{ nginx_vhosts }}" with_items: "{{ nginx_vhosts }}"
notify: reload nginx notify: reload nginx
when: item.delete is not defined or not item.delete when: item.delete is not defined or not item.delete
- name: FILE | Delete vhosts - name: FILE | Delete vhosts
file: path={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }} state=absent file: path={{ nginx_etc_dir }}/sites-available/{{ item.filename | default(item.name if item.name is string else item.name[0]) }} state=absent
with_items: "{{ nginx_vhosts }}" with_items: "{{ nginx_vhosts }}"
notify: reload nginx notify: reload nginx
when: item.delete is defined and item.delete when: item.delete is defined and item.delete
- name: FILE | Enable vhosts - name: FILE | Enable vhosts
file: > file: >
src={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }} src={{ nginx_etc_dir }}/sites-available/{{ item.filename | default(item.name if item.name is string else item.name[0]) }}
dest={{ nginx_etc_dir }}/sites-enabled/{{ item.name if item.name is string else item.name[0] }} dest={{ nginx_etc_dir }}/sites-enabled/{{ item.filename | default(item.name if item.name is string else item.name[0]) }}
state=link state=link
with_items: "{{ nginx_vhosts }}" with_items: "{{ nginx_vhosts }}"
notify: reload nginx notify: reload nginx
@ -54,7 +59,7 @@
(item.delete is not defined or not item.delete) (item.delete is not defined or not item.delete)
- name: FILE | Disable vhosts - name: FILE | Disable vhosts
file: path={{ nginx_etc_dir}}/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent file: path={{ nginx_etc_dir}}/sites-enabled/{{ item.filename | default(item.name if item.name is string else item.name[0]) }} state=absent
with_items: "{{ nginx_vhosts }}" with_items: "{{ nginx_vhosts }}"
notify: reload nginx notify: reload nginx
when: (item.enable is defined and not item.enable) or (item.delete is defined and item.delete) when: (item.enable is defined and not item.enable) or (item.delete is defined and item.delete)