summaryrefslogtreecommitdiff
path: root/manifests/master/update.pp
blob: fc301662073ba2b5d80e53c5b06c755fdbcf85a3 (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
class puppet::master::update(
  $method = hiera('puppet::master::update::method', 'cron')
) {
  # puppet update script
  file { "/usr/local/sbin/update-puppet-conf.sh":
    source => "puppet:///modules/puppet/update-puppet-conf.sh",
    owner  => "puppet",
    group  => "puppet",
    mode   => 0755,
    ensure => present,
  }

  # cron rule to update puppet config repository every 5 minutes
  cron { "puppet-update":
    command  => "/usr/local/sbin/update-puppet-conf.sh > /dev/null 2>&1",
    user     => puppet,
    minute   => "*/5",
    ensure   => $method ? {
      'cron'  => present,
      default => absent,
    },
    require  => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ],
  }

  # use a post-update hook
  file { '/var/git/repositories/puppet.git/hooks/post-update':
    mode   => 4750,
    owner  => puppet,
    group  => gitolite,
    ensure => $method ? {
      'cron'  => absent,
      default => present,
    },
    source => "puppet:///modules/puppet/post-update.sh",
  }

  # needed by the post-update hook above
  if !defined(Package['procmail']) {
    package { 'procmail':
      ensure => present,
    }
  }
}