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
|
# install/remove apache module on debian/ubuntu systems
define apache::debian::module(
$ensure = present,
$package_name = 'absent',
$conf_source = '',
$conf_content = '',
){
$modules_dir = "${apache::debian::config_dir}/mods"
if ($package_name != 'absent') {
package { $package_name:
ensure => $ensure,
notify => Service['apache'],
require => [ File['modules_dir'], Package['apache'] ],
}
$required_packages = [ 'apache', $package_name ]
}
else {
$required_packages = [ 'apache' ]
}
file {
"${modules_dir}-enabled/${name}.load":
ensure => "../mods-available/${name}.load",
notify => Service['apache'],
require => [ File['modules_dir'], Package[$required_packages] ];
"${modules_dir}-enabled/${name}.conf":
ensure => "../mods-available/${name}.conf",
notify => Service['apache'],
require => [ File['modules_dir'], Package[$required_packages] ];
"${modules_dir}-available/${name}.conf":
ensure => file,
notify => Service['apache'],
require => [ File['modules_dir'], Package[$required_packages] ];
}
if $conf_content != '' {
File["${modules_dir}-available/${name}.conf"] {
content => $conf_content,
}
}
elsif $conf_source != '' {
File["${modules_dir}-available/${name}.conf"] {
source => $conf_source,
}
}
}
|