Skip to content

Commit 5dbcdf4

Browse files
committed
Introduce an authz_core mod class
This removes duplication in default mods and makes it easy to use without default mods.
1 parent 9439655 commit 5dbcdf4

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

manifests/default_mods.pp

+3-17
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
}
132132
include apache::mod::alias
133133
include apache::mod::authn_file
134+
include apache::mod::authz_core
134135
include apache::mod::autoindex
135136
include apache::mod::dav
136137
include apache::mod::dav_fs
@@ -142,11 +143,6 @@
142143
include apache::mod::auth_basic
143144

144145
if versioncmp($apache_version, '2.4') >= 0 {
145-
# authz_core is needed for 'Require' directive
146-
::apache::mod { 'authz_core':
147-
id => 'authz_core_module',
148-
}
149-
150146
# lots of stuff seems to break without access_compat
151147
::apache::mod { 'access_compat': }
152148
} else {
@@ -159,18 +155,8 @@
159155
} elsif $mods {
160156
::apache::default_mods::load { $mods: }
161157

162-
if versioncmp($apache_version, '2.4') >= 0 {
163-
# authz_core is needed for 'Require' directive
164-
::apache::mod { 'authz_core':
165-
id => 'authz_core_module',
166-
}
167-
}
158+
include apache::mod::authz_core
168159
} else {
169-
if versioncmp($apache_version, '2.4') >= 0 {
170-
# authz_core is needed for 'Require' directive
171-
::apache::mod { 'authz_core':
172-
id => 'authz_core_module',
173-
}
174-
}
160+
include apache::mod::authz_core
175161
}
176162
}

manifests/mod/authz_core.pp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# @summary
2+
# Installs `mod_authz_core`.
3+
#
4+
# @param apache_version
5+
# The version of apache being run.
6+
#
7+
# @see https://httpd.apache.org/docs/current/mod/mod_authz_core.html for additional documentation.
8+
#
9+
class apache::mod::authz_core (
10+
Optional[String] $apache_version = $apache::apache_version
11+
) {
12+
if versioncmp($apache_version, '2.4') >= 0 {
13+
apache::mod { 'authz_core': }
14+
}
15+
}

0 commit comments

Comments
 (0)