From 54b08af08abd32860b06199389990496b373929b Mon Sep 17 00:00:00 2001 From: Jan Sellmann Date: Fri, 15 Sep 2023 13:42:50 +0200 Subject: [PATCH] add param to class apache::vhosts this add the possibility to pass vhosts_defaults to the class for enforcing some site-wide vhost stanards e.g. via Hiera or to significantly shorten the content of on nodes hosting many vhosts (#2325) --- manifests/vhosts.pp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/manifests/vhosts.pp b/manifests/vhosts.pp index 9ac49abaa3..c55ff50f73 100644 --- a/manifests/vhosts.pp +++ b/manifests/vhosts.pp @@ -13,14 +13,31 @@ # }, # }, # } -# +# @example To create a [name-based virtual host](https://httpd.apache.org/docs/current/vhosts/name-based.html) `custom_vhost_1` using vhosts_defaults +# class { 'apache::vhosts': +# vhosts_defaults => { +# 'access_log_format' => 'noip', +# 'priority' => false, +# }, +# vhosts => { +# 'custom_vhost_1' => { +# 'docroot' => '/var/www/custom_vhost_1', +# 'port' => 81, +# }, +# }, +# } # @param vhosts -# A hash, where the key represents the name and the value represents a hash of +# A hash, where the key represents the name and the value represents a hash of # `apache::vhost` defined type's parameters. +# @param vhosts_defaults +# A hash of `apache::vhost` defined type's parameters used as defaults for one +# or more vhosts - this could could be used to set vhosts_defaults on nodes +# with many vhosts or ensure site-wide vhosts_defaults in Hiera # class apache::vhosts ( - Hash $vhosts = {}, + Hash $vhosts = {}, + Hash $vhosts_defaults = {}, ) { include apache - create_resources('apache::vhost', $vhosts) + create_resources('apache::vhost', $vhosts, $vhosts_defaults) }