Major vhosts cleanup in preparation for issue #11.
This commit is contained in:
parent
c6e3321a66
commit
7360d9cb0b
|
@ -14,10 +14,13 @@ None.
|
|||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
nginx_remove_default_vhost: false
|
||||
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
|
||||
nginx_vhost_path: /etc/nginx/sites-enabled
|
||||
|
||||
Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base `/` URL to be directed at one of your own virtual hosts configured in a separate .conf file. The `nginx_default_vhost_path` variable defines the path to the default vhosts file.
|
||||
The path to the vhost configuration folder (where Nginx will look for server configurations).
|
||||
|
||||
nginx_remove_default_vhost: false
|
||||
|
||||
Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base `/` URL to be directed at one of your own virtual hosts configured in a separate .conf file.
|
||||
|
||||
nginx_user: "nginx"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ nginx_client_max_body_size: "64m"
|
|||
nginx_keepalive_timeout: "65"
|
||||
|
||||
nginx_remove_default_vhost: false
|
||||
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
|
||||
nginx_vhosts: []
|
||||
# TODO - add example.
|
||||
|
||||
nginx_proxy_cache_path: ""
|
||||
|
|
|
@ -28,9 +28,4 @@
|
|||
- name: Ensure nginx is started and enabled to start at boot.
|
||||
service: name=nginx state=started enabled=yes
|
||||
|
||||
- name: Remove default nginx config file (if configured).
|
||||
file:
|
||||
path: "{{ nginx_default_vhost_path }}"
|
||||
state: absent
|
||||
when: nginx_remove_default_vhost
|
||||
notify: restart nginx
|
||||
- include: vhosts.yml
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- name: Remove default nginx vhost config file (if configured).
|
||||
file:
|
||||
path: "{{ nginx_default_vhost_path }}"
|
||||
state: absent
|
||||
when: nginx_remove_default_vhost
|
||||
notify: restart nginx
|
||||
|
||||
- name: Add managed vhost config file (if any vhosts are configured).
|
||||
template:
|
||||
src: vhosts.j2
|
||||
dest: "{{ nginx_vhost_path }}/vhosts"
|
||||
mode: 0644
|
||||
when: nginx_vhosts
|
||||
notify: restart nginx
|
||||
|
||||
- name: Remove managed vhost config file (if no vhosts are configured).
|
||||
file:
|
||||
path: "{{ nginx_vhost_path }}/vhosts"
|
||||
state: absent
|
||||
when: not nginx_vhosts
|
||||
notify: restart nginx
|
|
@ -0,0 +1 @@
|
|||
# TODO
|
|
@ -1,2 +1,4 @@
|
|||
---
|
||||
nginx_vhost_path: /etc/nginx/sites-enabled
|
||||
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
|
||||
__nginx_user: "www-data"
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
---
|
||||
nginx_vhost_path: /etc/nginx/conf.d
|
||||
nginx_default_vhost_path: /etc/nginx/conf.d/default.conf
|
||||
__nginx_user: "nginx"
|
||||
|
|
Loading…
Reference in New Issue