2015-02-21 06:34:31 +01:00
|
|
|
---
|
|
|
|
- name: Remove default nginx vhost config file (if configured).
|
|
|
|
file:
|
|
|
|
path: "{{ nginx_default_vhost_path }}"
|
|
|
|
state: absent
|
|
|
|
when: nginx_remove_default_vhost
|
2015-12-22 17:55:29 +01:00
|
|
|
notify:
|
2016-01-22 10:26:39 +01:00
|
|
|
- reload nginx
|
2015-02-21 06:34:31 +01:00
|
|
|
|
|
|
|
- name: Add managed vhost config file (if any vhosts are configured).
|
|
|
|
template:
|
|
|
|
src: vhosts.j2
|
2015-02-21 07:02:51 +01:00
|
|
|
dest: "{{ nginx_vhost_path }}/vhosts.conf"
|
2015-02-21 06:34:31 +01:00
|
|
|
mode: 0644
|
2015-12-10 15:00:39 +01:00
|
|
|
when: nginx_vhosts|length > 0
|
2015-12-22 17:36:11 +01:00
|
|
|
notify:
|
2016-01-22 10:26:39 +01:00
|
|
|
- reload nginx
|
2015-02-21 06:34:31 +01:00
|
|
|
|
|
|
|
- name: Remove managed vhost config file (if no vhosts are configured).
|
|
|
|
file:
|
2015-02-21 07:02:51 +01:00
|
|
|
path: "{{ nginx_vhost_path }}/vhosts.conf"
|
2015-02-21 06:34:31 +01:00
|
|
|
state: absent
|
2015-12-10 15:00:39 +01:00
|
|
|
when: nginx_vhosts|length == 0
|
2015-12-22 17:36:11 +01:00
|
|
|
notify:
|
2016-01-22 10:26:39 +01:00
|
|
|
- reload nginx
|
2015-12-22 17:36:11 +01:00
|
|
|
|