PR #24: Clean up default vhost removal options and document the new var.

This commit is contained in:
Jeff Geerling 2015-07-23 12:04:31 -05:00
parent 2597e7380c
commit f98accbb08
3 changed files with 12 additions and 3 deletions

View file

@ -26,6 +26,10 @@ The ports on which apache should be listening. Useful if you have another servic
If set to true, a vhosts file, managed by this role's variables (see below), will be created and placed in the Apache configuration folder. If set to false, you can place your own vhosts file into Apache's configuration folder and skip the convenient (but more basic) one added by this role.
apache_remove_default_vhost: false
On Debian/Ubuntu, a default virtualhost is included in Apache's configuration. Set this to `true` to remove that default virtualhost configuration file.
apache_vhosts:
# Additional optional properties: 'serveradmin, serveralias, extra_parameters'.
- {servername: "local.dev", documentroot: "/var/www/html"}

View file

@ -4,10 +4,13 @@ apache_enablerepo: ""
apache_listen_port: 80
apache_listen_port_ssl: 443
apache_remove_default_vhost: false
apache_create_vhosts: true
apache_vhosts_filename: "vhosts.conf"
# On Debian/Ubuntu, a default virtualhost is included in Apache's configuration.
# Set this to `true` to remove that default.
apache_remove_default_vhost: false
apache_vhosts:
# Additional properties: 'serveradmin, serveralias, extra_parameters'.
- {servername: "local.dev", documentroot: "/var/www/html"}

View file

@ -38,10 +38,12 @@
src: "{{ apache_conf_path }}/sites-available/{{ apache_vhosts_filename }}"
dest: "{{ apache_conf_path }}/sites-enabled/{{ apache_vhosts_filename }}"
state: link
notify: restart apache
when: apache_create_vhosts
- name: Remove default vhost symlink in sites-enabled.
- name: Remove default vhost in sites-enabled.
file:
path: "{{ apache_conf_path }}/sites-enabled/{{ apache_default_vhost_filename }}"
state: absent
notify: restart apache
when: apache_remove_default_vhost