Add option to remove default nginx vhost config.

pull/3/head
Jeff Geerling 10 years ago
parent 38a6c071e0
commit 736a95a012
  1. 7
      README.md
  2. 3
      defaults/main.yml
  3. 7
      tasks/main.yml

@ -12,7 +12,12 @@ None.
## Role Variables
Available variables are listed below, along with default values (see `vars/main.yml`):
Available variables are listed below, along with default values (see `vars/main.yml` and `defaults/main.yml`):
nginx_remove_default_vhost: false
nginx_default_vhost_path: /etc/nginx/sites-enabled/default
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.
nginx_user: "nginx"

@ -0,0 +1,3 @@
---
nginx_remove_default_vhost: false
nginx_default_vhost_path: /etc/nginx/sites-enabled/default

@ -23,3 +23,10 @@
- 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