Puppet Class: puppet::agent::service

Defined in:
manifests/agent/service.pp

Overview

Private class

Parameters:

  • enable (Any) (defaults to: true)


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
57
# File 'manifests/agent/service.pp', line 2

class puppet::agent::service (
  $enable = true
) {

  include puppet::params

  if $enable {
    $ensure = running
  } else {
    $ensure = stopped
  }

  # ----
  # Puppet agent management
  service { 'puppet_agent':
    ensure     => $ensure,
    name       => $puppet::params::agent_service,
    enable     => $enable,
    hasstatus  => true,
    hasrestart => true,
  }

  # ----
  # Special things for special kernels
  case $::kernel {
    darwin: {
      file { 'com.puppetlabs.puppet.plist':
        owner   => 'root',
        group   => '0',
        mode    => '0644',
        content => template('puppet/com.puppetlabs.puppet.plist.erb'),
        path    => '/Library/LaunchDaemons/com.puppetlabs.puppet.plist',
        before  => Service['puppet_agent'],
        replace => false,
      }
    }
    default: {

      if $puppet::params::agent_service_conf {
        $file_ensure = $puppet::params::agent_service_conf ? {
          undef   => 'absent',
          default => 'present',
        }

        file { 'puppet_agent_service_conf':
          ensure  => $file_ensure,
          mode    => '0644',
          owner   => 'root',
          group   => 'root',
          content => template('puppet/agent_service.erb'),
          path    => $puppet::params::agent_service_conf,
        }
      }
    }
  }
}