summaryrefslogtreecommitdiff
path: root/manifests/base.pp
blob: 5cb4c5d566f89903932f7503516c34484b31393a (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# configure general things of puppet
class puppet::base {

  $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1')
  case $puppet::cleanup_clientbucket {
    # if not set, don't do anything
    '',undef,false: {}
    default: {
      tidy { '/var/lib/puppet/clientbucket':
        backup  => false,
        recurse => true,
        rmdirs  => true,
        type    => mtime,
        age     => $puppet::cleanup_clientbucket;
      }
    }
  }

  file { 'puppet_config':
    path    => $puppet::config,
    notify  => Service[puppet],
    # if puppetmasterd is deployed by apache2/passenger it needs
    # to read puppet.conf. therefore it must be readable by puppet
    owner   => puppet,
    group   => 0,
    mode    => '0600';
  }
  if $puppet::config_content {
    File['puppet_config'] {
      content => $puppet::config_content
    }
  } else {
    File['puppet_config'] {
      source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf",
                  "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}",
                  'puppet:///modules/site_puppet/client/puppet.conf',
                  "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}",
                  "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf",
                  "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}",
                  'puppet:///modules/puppet/client/puppet.conf' ]
    }
  }

  service { 'puppet':
    ensure      => running,
    enable      => true,
    hasstatus   => true,
    hasrestart  => true,
  }
}