We have no lsbmajdistrelease <= 7 hosts anymore
[mirror/dsa-puppet.git] / modules / apache2 / manifests / config.pp
1 define apache2::config (
2         $source=undef,
3         $content=undef,
4         $ensure=present
5 ) {
6
7         include apache2
8
9         case $ensure {
10                 present: {
11                         if ! ($source or $content) {
12                                 fail ( "No configuration found for ${name}" )
13                         }
14                 }
15                 absent:  {}
16                 default: { fail ( "Unknown ensure value: '$ensure'" ) }
17         }
18
19         if $content {
20                 file { "/etc/apache2/conf-available/${name}.conf":
21                         ensure  => $ensure,
22                         content => $content,
23                         require => Package['apache2'],
24                         notify  => Exec['service apache2 reload'],
25                 }
26         } else {
27                 file { "/etc/apache2/conf-available/${name}.conf":
28                         ensure  => $ensure,
29                         source  => $source,
30                         require => Package['apache2'],
31                         notify  => Exec['service apache2 reload'],
32                 }
33         }
34
35         $link_ensure = $ensure ? {
36                 present => link,
37                 absent  => absent
38         }
39
40         file { "/etc/apache2/conf-enabled/${name}.conf":
41                 ensure => $link_ensure,
42                 target => "../conf-available/${name}.conf",
43                 notify  => Exec['service apache2 reload'],
44         }
45 }