1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
# @summary
# Installs and configures `mod_userdir`.
#
# @param userdir
# Path or directory name to be used as the UserDir.
#
# @param disable_root
# Toggles whether to allow use of root directory.
#
# @param path
# Path to directory or pattern from which to find user-specific directories.
#
# @param overrides
# Array of directives that are allowed in .htaccess files.
#
# @param options
# Configures what features are available in a particular directory.
#
# @param unmanaged_path
# Toggles whether to manage path in userdir.conf
#
# @param custom_fragment
# Custom configuration to be added to userdir.conf
#
# @see https://httpd.apache.org/docs/current/mod/mod_userdir.html for additional documentation.
#
class apache::mod::userdir (
Optional[String[1]] $userdir = undef,
Boolean $disable_root = true,
String $path = '/home/*/public_html',
Array[String] $overrides = ['FileInfo', 'AuthConfig', 'Limit', 'Indexes'],
Array[String] $options = ['MultiViews', 'Indexes', 'SymLinksIfOwnerMatch', 'IncludesNoExec'],
Boolean $unmanaged_path = false,
Optional[String] $custom_fragment = undef,
) {
include apache
::apache::mod { 'userdir': }
$parameters = {
'disable_root' => $disable_root,
'userdir' => pick($userdir, $path),
'unmanaged_path' => $unmanaged_path,
'path' => $path,
'overrides' => $overrides,
'options' => $options,
'custom_fragment' => $custom_fragment,
}
file { 'userdir.conf':
ensure => file,
path => "${apache::mod_dir}/userdir.conf",
mode => $apache::file_mode,
content => epp('apache/mod/userdir.conf.epp', $parameters),
require => Exec["mkdir ${apache::mod_dir}"],
before => File[$apache::mod_dir],
notify => Class['apache::service'],
}
}
|