summaryrefslogtreecommitdiff
path: root/manifests/puppetd.pp
blob: c35410ac28873648062f16c9626f234a6d4c06f6 (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
51
52
53
54
55
56
# handles puppetd service
class puppetd inherits puppet {

  package { "puppet":
   ensure  => installed,
   require => Package["cron"],
  }

  service { "puppet":
    enable     => true,
    ensure     => running,
    hasrestart => true,
    require    => Package["puppet"],
  }

  # default config file for puppet nodes
  case $puppetmasterd_present {
    true: { }
    default: {
      file { "/etc/puppet/puppet.conf":
        ensure  => file,
        owner   => puppet,
        group   => puppet,
        mode    => 0644,
        content => template("puppet/puppet-node.conf.erb"),
      }
    }
  }

  # cron rule to restart puppet minutes after puppetmaster is restarted
  cron { "puppet-restart":
    command  => "/etc/init.d/puppet restart &> /dev/null",
    user     => root,
    hour     => "*/1",
    minute   => "10",
    ensure   => absent,
    require  => Service["puppet"],
  }

  file { "/usr/local/sbin/check-puppetd.sh":
    source => "puppet://$server/modules/puppet/check-puppetd.sh",
    owner  => "puppet",
    group  => "puppet",
    mode   => 0755,
    ensure => present,
  }

  cron { "puppetd-check":
    command  => "/usr/local/sbin/check-puppetd.sh &> /dev/null",
    user     => root,
    hour     => "*/1",
    minute   => "0",
    require  => File["/usr/local/sbin/check-puppetd.sh"],
    ensure   => present,
  }
}