From 4c87d22f47b0d89dc69496947c8deab841ae4d25 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Sun, 4 Oct 2015 12:39:58 +0200 Subject: [PATCH] Add option to configure the include pattern for the vhost_enable dir --- README.md | 10 ++++++++++ manifests/init.pp | 1 + manifests/params.pp | 2 ++ templates/httpd.conf.erb | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a36c2eff..5066caac9 100644 --- a/README.md +++ b/README.md @@ -1126,6 +1126,16 @@ Changes your virtual host configuration files' location. Default: determined by - **Gentoo**: `/etc/apache2/vhosts.d` - **Red Hat**: `/etc/httpd/conf.d` +##### `vhost_include_pattern` + +Defines the pattern for files included from the `vhost_dir`. This defaults to '*', also for BC with previous versions of this module. + +However, you may want to set this to a value like '[^.#]\*.conf[^~]' to make sure files accidentally created in this directory (from version +control systems, editor backups or the like) are *not* included in your server configuration. + +A value of '*.conf' is what is shipped by some operating systems. Also note that this module will, by default, create config files ending +in '.conf'. + ##### `user` Changes the user Apache uses to answer requests. Apache's parent process will continue to be run as root, but child processes will access resources as the user defined by this parameter. diff --git a/manifests/init.pp b/manifests/init.pp index 5f02bfd61..873b42ef4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -46,6 +46,7 @@ $confd_dir = $::apache::params::confd_dir, $vhost_dir = $::apache::params::vhost_dir, $vhost_enable_dir = $::apache::params::vhost_enable_dir, + $vhost_include_pattern = $::apache::params::vhost_include_pattern, $mod_dir = $::apache::params::mod_dir, $mod_enable_dir = $::apache::params::mod_enable_dir, $mpm_module = $::apache::params::mpm_module, diff --git a/manifests/params.pp b/manifests/params.pp index 5c5233ccd..a2ab7382c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -32,6 +32,8 @@ # should we use systemd module? $use_systemd = true + $vhost_include_pattern = '*' + if $::operatingsystem == 'Ubuntu' and $::lsbdistrelease == '10.04' { $verify_command = '/usr/sbin/apache2ctl -t' } else { diff --git a/templates/httpd.conf.erb b/templates/httpd.conf.erb index 8664a43e4..e0d16e122 100644 --- a/templates/httpd.conf.erb +++ b/templates/httpd.conf.erb @@ -85,9 +85,9 @@ Include "<%= @confd_dir %>/*.conf" <%- end -%> <% if @vhost_load_dir != @confd_dir -%> <%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%> -IncludeOptional "<%= @vhost_load_dir %>/*" +IncludeOptional "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>" <%- else -%> -Include "<%= @vhost_load_dir %>/*" +Include "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>" <%- end -%> <% end -%>