summaryrefslogtreecommitdiff
path: root/manifests/vhost/file.pp
blob: 4b0416a9cf016eb93e4b51d7cf717ea794dc13e1 (plain)
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
define lighttpd::vhost::file(
    $ensure = present,
    $vhost_source = 'absent',
    $content = 'absent'
){
  include ::lighttpd::vhosts
  file{"/etc/lighttpd/vhosts.d/${name}.conf":
    ensure => $ensure,
    notify => Service['lighttpd'],
    owner => root, group => 0, mode => 0644;
  }

  if $ensure != 'absent' {
    case $content {
      'absent': {
        File["/etc/lighttpd/vhosts.d/${name}.conf"]{
          source => $vhost_source ? {
            'absent'  => [
              "puppet:///modules/site_lighttpd/vhosts.d/${::fqdn}/${name}.conf",
              "puppet:///modules/site_lighttpd/vhosts.d/${lighttpd::cluster_node}/${name}.conf",
              "puppet:///modules/site_lighttpd/vhosts.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
              "puppet:///modules/site_lighttpd/vhosts.d/${::operatingsystem}/${name}.conf",
              "puppet:///modules/site_lighttpd/vhosts.d/${name}.conf"
            ],
            default => "puppet:///${vhost_source}",
          }
        }
      }
      default: {
        File["/etc/lighttpd/vhosts.d/${name}.conf"]{
          content => $content,
        }
      }
    }
  }
}