From 8b004409040189c20bcc020957b377560c340d26 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 | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/manifests/vhosts.pp b/manifests/vhosts.pp index 9ac49abaa3..4e6edc2c0e 100644 --- a/manifests/vhosts.pp +++ b/manifests/vhosts.pp @@ -1,6 +1,6 @@ # @summary # Creates `apache::vhost` defined types. -# +# # @note See the `apache::vhost` defined type's reference for a list of all virtual # host parameters or Configuring virtual hosts in the README section. # @@ -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 - use this parameter 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) }