From 5dbcdf42dc0acc3947752e128d8627a9ab24a297 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 10 Aug 2022 13:43:20 +0200 Subject: [PATCH] Introduce an authz_core mod class This removes duplication in default mods and makes it easy to use without default mods. --- manifests/default_mods.pp | 20 +++----------------- manifests/mod/authz_core.pp | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 manifests/mod/authz_core.pp diff --git a/manifests/default_mods.pp b/manifests/default_mods.pp index 1b71b158e8..9e9963431d 100644 --- a/manifests/default_mods.pp +++ b/manifests/default_mods.pp @@ -131,6 +131,7 @@ } include apache::mod::alias include apache::mod::authn_file + include apache::mod::authz_core include apache::mod::autoindex include apache::mod::dav include apache::mod::dav_fs @@ -142,11 +143,6 @@ include apache::mod::auth_basic if versioncmp($apache_version, '2.4') >= 0 { - # authz_core is needed for 'Require' directive - ::apache::mod { 'authz_core': - id => 'authz_core_module', - } - # lots of stuff seems to break without access_compat ::apache::mod { 'access_compat': } } else { @@ -159,18 +155,8 @@ } elsif $mods { ::apache::default_mods::load { $mods: } - if versioncmp($apache_version, '2.4') >= 0 { - # authz_core is needed for 'Require' directive - ::apache::mod { 'authz_core': - id => 'authz_core_module', - } - } + include apache::mod::authz_core } else { - if versioncmp($apache_version, '2.4') >= 0 { - # authz_core is needed for 'Require' directive - ::apache::mod { 'authz_core': - id => 'authz_core_module', - } - } + include apache::mod::authz_core } } diff --git a/manifests/mod/authz_core.pp b/manifests/mod/authz_core.pp new file mode 100644 index 0000000000..2520ab40a1 --- /dev/null +++ b/manifests/mod/authz_core.pp @@ -0,0 +1,15 @@ +# @summary +# Installs `mod_authz_core`. +# +# @param apache_version +# The version of apache being run. +# +# @see https://httpd.apache.org/docs/current/mod/mod_authz_core.html for additional documentation. +# +class apache::mod::authz_core ( + Optional[String] $apache_version = $apache::apache_version +) { + if versioncmp($apache_version, '2.4') >= 0 { + apache::mod { 'authz_core': } + } +}