Puppet Class: dispatcher
- Defined in:
- manifests/init.pp
Summary
Installs and sets up the AEM Dispatcher module on your system.Overview
When this class is declared with the default options, Puppet:
-
Installs the specified dispatcher module into Apache modules directory
-
Defines a Puppet apache module resource for the dispatcher.
-
Defines a default set of Dispatcher configurations
-
Loads all defined dispatcher farms
-
Reloads the Apache service
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'manifests/init.pp', line 91
class dispatcher (
Stdlib::Filesource $module_file,
Boolean $decline_root,
Stdlib::Absolutepath $log_file,
Enum['error', 'warn', 'info', 'debug', 'trace'] $log_level,
Variant[Boolean, Pattern[/^[\d\-,]+$/]] $pass_error,
Boolean $use_processed_url,
Array[String] $farms = [],
Optional[Integer[0]] $keep_alive_timeout = undef,
Optional[Boolean] $no_cannon_url = undef,
Array[String] $vhosts = [],
) {
# Check for Apache because it is used by parameter defaults
if !defined(Class['apache']) {
fail('You must include the Apache class before using any dispatcher class or resources.')
}
if $::osfamily == 'RedHat' or $::operatingsystem =~ /^[Aa]mazon$/ {
$_mod_path = "${::apache::httpd_dir}/${::apache::lib_path}"
$_farm_path = $::apache::mod_dir
} elsif $::osfamily == 'Debian' {
$_mod_path = $::apache::lib_path
$_farm_path = $::apache::mod_enable_dir
} else {
fail("Class['dispatcher']: Unsupported osfamily: ${::osfamily}")
}
$_filename = basename($module_file)
$_owner = 'root'
apache::mod { 'dispatcher':
lib => 'mod_dispatcher.so',
}
file { "${_mod_path}/${_filename}":
ensure => file,
owner => $_owner,
group => $::apache::params::root_group,
source => $module_file,
require => Package['httpd'],
notify => Class['Apache::Service'],
}
file { "${_mod_path}/mod_dispatcher.so":
ensure => link,
owner => $_owner,
group => $::apache::params::root_group,
target => "${_mod_path}/${_filename}",
require => Package['httpd'],
notify => Class['Apache::Service'],
}
if $facts['selinux_enforced'] {
File["${_mod_path}/${_filename}"] {
seltype => 'httpd_modules_t',
}
File["${_mod_path}/mod_dispatcher.so"] {
seltype => 'httpd_modules_t',
}
ensure_resource('selboolean', 'httpd_can_network_connect', { value => 'on', persistent => true })
}
file { "${_farm_path}/dispatcher.conf":
ensure => file,
owner => $_owner,
group => $::apache::params::root_group,
content => template("${module_name}/dispatcher.conf.erb"),
require => Package['httpd'],
notify => Class['Apache::Service'],
}
file { "${_farm_path}/dispatcher.farms.any":
ensure => file,
owner => $_owner,
group => $::apache::params::root_group,
source => 'puppet:///modules/dispatcher/dispatcher.farms.any',
require => Package['httpd'],
notify => Class['Apache::Service'],
}
$farms.each |$farm| {
ensure_resource('dispatcher::farm', $farm, { 'ensure' => 'present' })
}
$fragment = "\n <IfModule disp_apache2.c>\n SetHandler dispatcher-handler\n </IfModule>\n\n"
$vhosts.each |$vhost| {
apache::vhost::fragment { "${vhost}-dispatcher-fragment":
vhost => $vhost,
priority => getparam(Apache::Vhost[$vhost], 'priority'),
content => $fragment
}
}
}
|