mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-10-04 05:07:31 +02:00
8aa51642b4
In particular, the default /usr/local/etc/nginx/sites-enabled directory does not exist on installation of Nginx on FreeBSD.
34 lines
772 B
YAML
34 lines
772 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: Create nginx_vhost_path directory.
|
|
file:
|
|
path: "{{ nginx_vhost_path }}"
|
|
state: directory
|
|
notify:
|
|
- reload nginx
|
|
|
|
- name: Add managed vhost config file (if any vhosts are configured).
|
|
template:
|
|
src: vhosts.j2
|
|
dest: "{{ nginx_vhost_path }}/vhosts.conf"
|
|
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 }}/vhosts.conf"
|
|
state: absent
|
|
when: nginx_vhosts|length == 0
|
|
notify:
|
|
- reload nginx
|
|
|