Puppet Class: puppet::service

Inherits:
puppet::params
Defined in:
manifests/service.pp

Summary

Puppet server service management

Overview

puppet::service

Puppet server service management

Examples:

include puppet::service

Parameters:

  • server_service_ensure (String) (defaults to: $puppet::server_service_ensure)
  • server_service_enable (Boolean) (defaults to: $puppet::server_service_enable)
  • service_name (String) (defaults to: $puppet::params::service_name)
  • manage_init_config (Boolean) (defaults to: $puppet::params::manage_init_config)

    Whether to manage init configuration file

  • init_config_path (Stdlib::Unixpath) (defaults to: $puppet::params::init_config_path)

    Full path to init configuration file (either /etc/sysconfig/puppetserver or /etc/default/puppetserver, depending on your distribution)

  • init_config_template (Optional[String]) (defaults to: $puppet::params::init_config_template)

    EPP template to setup Puppet server init configuration file from

  • tmpdir (Stdlib::Unixpath) (defaults to: '/tmp')
  • min_heap_size (Puppet::JavaSize) (defaults to: '2g')

    Sets the minimum and initial size (in bytes) of the heap (aka -XX:MinHeapSize, -Xms) developers.redhat.com/articles/2021/09/09/how-jvm-uses-and-allocates-memory

  • max_heap_size (Puppet::JavaSize) (defaults to: '2g')

    Specifies the maximum size (in bytes) of the memory allocation pool (aka -XX:MaxHeapSize, -Xmx)



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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'manifests/service.pp', line 33

class puppet::service (
  String  $server_service_ensure = $puppet::server_service_ensure,
  Boolean $server_service_enable = $puppet::server_service_enable,
  String  $service_name = $puppet::params::service_name,
  Boolean $manage_init_config = $puppet::params::manage_init_config,
  Stdlib::Unixpath $init_config_path = $puppet::params::init_config_path,
  Optional[String] $init_config_template = $puppet::params::init_config_template,
  Stdlib::Unixpath $tmpdir = '/tmp',
  Puppet::JavaSize $min_heap_size = '2g',
  Puppet::JavaSize $max_heap_size = '2g',
) inherits puppet::params {
  include puppet::server::install
  include puppet::enc
  include puppet::config
  include puppet::server::ca::allow

  $tmp_mountpoint_noexec = $puppet::params::tmp_mountpoint_noexec

  # Try to fix `tmp directory mounted noexec` issue automatically
  # https://www.puppet.com/docs/puppet/8/server/known_issues.html#tmp-directory-mounted-noexec
  if $tmpdir == '/tmp' and $tmp_mountpoint_noexec {
    $java_io_tmpdir = '/var/tmp'
  }
  else {
    $java_io_tmpdir = $tmpdir
  }

  if $manage_init_config and $init_config_template {
    file { $init_config_path:
      ensure  => file,
      content => epp($init_config_template, {
          tmpdir        => $java_io_tmpdir,
          min_heap_size => $min_heap_size,
          max_heap_size => $max_heap_size,
      }),
      before  => Service['puppet-server'],
    }
  }

  service { 'puppet-server':
    ensure => $server_service_ensure,
    name   => $service_name,
    enable => $server_service_enable,
  }

  Class['puppet::server::install'] ~> Service['puppet-server']
  Class['puppet::config'] ~> Service['puppet-server']
  Class['puppet::server::ca::allow'] ~> Service['puppet-server']
  Class['puppet::enc'] -> Service['puppet-server']
}