summaryrefslogtreecommitdiff
path: root/manifests/puppetd.pp
blob: a26bba21bba43a174600527e8739f4c43a299938 (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
# handles puppetd service
class puppetd inherits puppet {

  package { "cron": ensure  => installed, }

  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 {
    false: {
      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"],
  }
}