Fix regression (merge?): filename for vhosts
parent
078c3420e1
commit
7cc44bc009
|
@ -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
|
||||
fail: msg="Missmatch configuration for vhost {{ item.name if item.name is string else item.name[0] }}"
|
||||
when: >
|
||||
|
@ -30,21 +35,21 @@
|
|||
- name: TEMPLATE | Create vhosts
|
||||
template: >
|
||||
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 }}"
|
||||
notify: reload nginx
|
||||
when: item.delete is not defined or not item.delete
|
||||
|
||||
- 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 }}"
|
||||
notify: reload nginx
|
||||
when: item.delete is defined and item.delete
|
||||
|
||||
- name: FILE | Enable vhosts
|
||||
file: >
|
||||
src={{ nginx_etc_dir }}/sites-available/{{ 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] }}
|
||||
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.filename | default(item.name if item.name is string else item.name[0]) }}
|
||||
state=link
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
|
@ -54,7 +59,7 @@
|
|||
(item.delete is not defined or not item.delete)
|
||||
|
||||
- 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 }}"
|
||||
notify: reload nginx
|
||||
when: (item.enable is defined and not item.enable) or (item.delete is defined and item.delete)
|
||||
|
|
Loading…
Reference in New Issue