3 $package_ensure = 'present',
5 $lib_path = $::apache::lib_path,
8 $loadfile_name = undef,
11 if ! defined(Class['apache']) {
12 fail('You must include the apache base class before using any apache defined resources')
16 #include apache #This creates duplicate resources in rspec-puppet
17 $mod_dir = $::apache::mod_dir
19 # Determine if we have special lib
20 $mod_libs = $::apache::params::mod_libs
23 } elsif has_key($mod_libs, $mod) { # 2.6 compatibility hack
24 $_lib = $mod_libs[$mod]
26 $_lib = "mod_${mod}.so"
29 # Determine if declaration specified a path to the module
33 $_path = "${lib_path}/${_lib}"
39 $_id = "${mod}_module"
43 $_loadfile_name = $loadfile_name
45 $_loadfile_name = "${mod}.load"
48 # Determine if we have a package
49 $mod_packages = $::apache::params::mod_packages
52 } elsif has_key($mod_packages, $mod) { # 2.6 compatibility hack
53 $_package = $mod_packages[$mod]
57 if $_package and ! defined(Package[$_package]) {
58 # note: FreeBSD/ports uses apxs tool to activate modules; apxs clutters
59 # httpd.conf with 'LoadModule' directives; here, by proper resource
60 # ordering, we ensure that our version of httpd.conf is reverted after
61 # the module gets installed.
62 $package_before = $::osfamily ? {
64 File[$_loadfile_name],
65 File["${::apache::conf_dir}/${::apache::params::conf_file}"]
67 default => File[$_loadfile_name],
69 # if there are any packages, they should be installed before the associated conf file
70 Package[$_package] -> File<| title == "${mod}.conf" |>
71 # $_package may be an array
73 ensure => $package_ensure,
74 require => Package['httpd'],
75 before => $package_before,
79 file { $_loadfile_name:
81 path => "${mod_dir}/${_loadfile_name}",
83 group => $::apache::params::root_group,
85 content => template('apache/mod/load.erb'),
88 Exec["mkdir ${mod_dir}"],
90 before => File[$mod_dir],
91 notify => Class['apache::service'],
94 if $::osfamily == 'Debian' {
95 $enable_dir = $::apache::mod_enable_dir
96 file{ "${_loadfile_name} symlink":
98 path => "${enable_dir}/${_loadfile_name}",
99 target => "${mod_dir}/${_loadfile_name}",
101 group => $::apache::params::root_group,
104 File[$_loadfile_name],
105 Exec["mkdir ${enable_dir}"],
107 before => File[$enable_dir],
108 notify => Class['apache::service'],
110 # Each module may have a .conf file as well, which should be
111 # defined in the class apache::mod::module
112 # Some modules do not require this file.
113 if defined(File["${mod}.conf"]) {
114 file{ "${mod}.conf symlink":
116 path => "${enable_dir}/${mod}.conf",
117 target => "${mod_dir}/${mod}.conf",
119 group => $::apache::params::root_group,
123 Exec["mkdir ${enable_dir}"],
125 before => File[$enable_dir],
126 notify => Class['apache::service'],
129 } elsif $::osfamily == 'Suse' {
130 $enable_dir = $::apache::mod_enable_dir
131 file{ "${_loadfile_name} symlink":
133 path => "${enable_dir}/${_loadfile_name}",
134 target => "${mod_dir}/${_loadfile_name}",
136 group => $::apache::params::root_group,
139 File[$_loadfile_name],
140 Exec["mkdir ${enable_dir}"],
142 before => File[$enable_dir],
143 notify => Class['apache::service'],
145 # Each module may have a .conf file as well, which should be
146 # defined in the class apache::mod::module
147 # Some modules do not require this file.
148 if defined(File["${mod}.conf"]) {
149 file{ "${mod}.conf symlink":
151 path => "${enable_dir}/${mod}.conf",
152 target => "${mod_dir}/${mod}.conf",
154 group => $::apache::params::root_group,
158 Exec["mkdir ${enable_dir}"],
160 before => File[$enable_dir],
161 notify => Class['apache::service'],