ansible-role-nginx/tasks/vhosts.yml
2016-06-28 11:35:43 +02:00

26 lines
666 B
YAML

---
- name: Remove default nginx vhost config file (if configured).
file:
path: "{{ nginx_default_vhost_path }}"
state: absent
when: nginx_remove_default_vhost
notify:
- reload nginx
- name: Add managed vhost config file (if any vhosts are configured).
template:
src: vhosts.j2
dest: "{{ nginx_vhost_path }}/{{ nginx_vhosts_filename }}"
mode: 0644
when: nginx_vhosts|length > 0
notify:
- reload nginx
- name: Remove managed vhost config file (if no vhosts are configured).
file:
path: "{{ nginx_vhost_path }}/{{ nginx_vhosts_filename }}"
state: absent
when: nginx_vhosts|length == 0
notify:
- reload nginx