Puppet Class: psick::puppet::osp_agent

Defined in:
manifests/puppet/osp_agent.pp

Overview

This class manages Open Source Puppet Agent

Parameters:

  • manage_installation (Boolean) (defaults to: true)
  • tp_params (Hash) (defaults to: {})
  • cronjob_ensure (Enum['present','absent']) (defaults to: 'absent')
  • cronjob_schedule (String) (defaults to: '0,30 * * * *')
  • manage_service (Boolean) (defaults to: true)
  • service_ensure (Enum['running','stopped']) (defaults to: 'running')
  • settings (Hash) (defaults to: {})
  • config_template (String) (defaults to: 'psick/generic/inifile_with_stanzas.erb')
  • manage (Boolean) (defaults to: $psick::manage)
  • noop_manage (Boolean) (defaults to: $psick::noop_manage)
  • noop_value (Boolean) (defaults to: $psick::noop_value)


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
# File 'manifests/puppet/osp_agent.pp', line 3

class psick::puppet::osp_agent (
  Boolean $manage_installation = true,
  Hash $tp_params              = {},

  Enum['present','absent'] $cronjob_ensure = 'absent',
  String $cronjob_schedule                 = '0,30 * * * *',

  Boolean                   $manage_service = true,
  Enum['running','stopped'] $service_ensure = 'running',

  Hash $settings              = {},
  String $config_template     = 'psick/generic/inifile_with_stanzas.erb',

  Boolean $manage             = $psick::manage,
  Boolean $noop_manage        = $psick::noop_manage,
  Boolean $noop_value         = $psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    # Manage Puppet agent service
    if $manage_installation {
      $local_params = {
        'settings_hash' => {
          service_ensure => $service_ensure,
        },
        manage_service => $manage_service,
      }
      tp::install { 'puppet-agent':
        * => $local_params + $tp_params,
      }
    }

    if $settings != {} {
      tp::conf { 'puppet-agent':
        content => psick::template($config_template),
      }
    }

    if $facts['os']['kernel'] != 'windows' {
      file { '/etc/cron.d/puppet-agent':
        ensure  => $cronjob_ensure,
        content => "PATH=/opt/puppetlabs/puppet/bin:/usr/sbin:/usr/bin\n${cronjob_schedule} root puppet agent -t",
      }
    }
  }
}