diff --git a/README.md b/README.md index a88c26b..2e237e1 100644 --- a/README.md +++ b/README.md @@ -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"} diff --git a/defaults/main.yml b/defaults/main.yml index 8c1a3a4..1d2597a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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"} diff --git a/tasks/configure-Debian.yml b/tasks/configure-Debian.yml index fbe90ad..b39e191 100644 --- a/tasks/configure-Debian.yml +++ b/tasks/configure-Debian.yml @@ -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