mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-11-04 08:50:21 +01:00
5294d77fa3
NOTE: current nginx config validation process breaks SELinux context for pid file, as described in #41 Restart of nginx is not needed for configuration changes and is replaced with reload, which will validate config before applying it, leaving running nginx process untouched in case of any validation errors. Restart handler left in support.
27 lines
635 B
YAML
27 lines
635 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 }}/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
|
|
|