Puppet Class: pupmod::master::sysconfig

Inherits:
pupmod
Defined in:
manifests/master/sysconfig.pp

Overview

This class provides the sysconfig settings for the “puppetserver“ daemon.

to use. To use the default enter ‘default’. (Does not affect PE.)

Parameters:

  • install_dir (Stdlib::AbsolutePath)

    The installation directory for the “puppetserver“.

  • config (Stdlib::AbsolutePath)

    The configuration directory for the “puppetserver“.

  • bootstrap_config (Array[Stdlib::AbsolutePath])

    The bootstrap configuration directory for the “puppetserver“.

  • java_bin (Stdlib::AbsolutePath) (defaults to: '/usr/bin/java')

    The path to the java executable that the Puppet server should use on the system.

  • java_start_memory (Optional[Pupmod::Memory]) (defaults to: undef)

    The amount of memory to allocate on service startup.

  • java_max_memory (Optional[Pupmod::Memory]) (defaults to: undef)

    The maximum amount of memory to allocate within the system.

  • jruby_jar (String) (defaults to: 'jruby-9k.jar')

    The name of the jar file located in /opt/puppetlabs/apps/puppetserver

  • java_temp_dir (Optional[Stdlib::AbsolutePath]) (defaults to: undef)

    The temporary directory to be used for periodic executables.

    • This should not be “/tmp“, “/var/tmp“, or “/dev/shm“ on SIMP systems due to the default disabling of exec on those spaces.

    • Preceeding directories will not be created.

  • extra_java_args (Optional[Array[String]]) (defaults to: undef)

    An “Array“ that will be joined and appended to the Java argument list.

    • The sanity and syntax of this list will not be checked.

  • use_code_cache_flushing (Boolean) (defaults to: true)

    Enable code cache flushing to alleviate memory strain on the server

  • reserved_code_cache (Integer[0]) (defaults to: pupmod::reserved_code_cache())

    An “Integer“ of the MB to be used for JRuby options of ReservedCodeCache

    • By default, this will auto-populate based on function

  • service_stop_retries (Integer) (defaults to: 60)

    The number of times to attempt to stop the puppetserver process before failing.

  • start_timeout (Integer) (defaults to: 120)

    The number of seconds after which the service will be determined to have failed to start.

  • server_distribution (Simplib::ServerDistribution) (defaults to: pupmod::server_distribution())

    The Puppet distribution that is being managed.

  • user (String) (defaults to: pick($facts.dig('puppet_settings','server','user'),$facts.dig('puppet_settings','master','user')))

    The “user“ that the “puppetserver“ service will run as.

  • group (String) (defaults to: pick($facts.dig('puppet_settings','server','group'),$facts.dig('puppet_settings','master','group')))

    The “group“ that the “puppetserver“ service will run as.

  • mock (Boolean) (defaults to: false)

    Do not apply this class, only mock it up

See Also:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'manifests/master/sysconfig.pp', line 67

class pupmod::master::sysconfig (
  Stdlib::AbsolutePath           $install_dir,
  Stdlib::AbsolutePath           $config,
  Array[Stdlib::AbsolutePath]    $bootstrap_config,
  Stdlib::AbsolutePath           $java_bin                = '/usr/bin/java',
  Optional[Pupmod::Memory]       $java_start_memory       = undef,
  Optional[Pupmod::Memory]       $java_max_memory         = undef,
  Optional[Stdlib::AbsolutePath] $java_temp_dir           = undef,
  String                         $jruby_jar               = 'jruby-9k.jar',
  Optional[Array[String]]        $extra_java_args         = undef,
  Boolean                        $use_code_cache_flushing = true,
  Integer[0]                     $reserved_code_cache     = pupmod::reserved_code_cache(),
  Integer                        $service_stop_retries    = 60,
  Integer                        $start_timeout           = 120,
  Simplib::ServerDistribution    $server_distribution     = pupmod::server_distribution(),
  String                         $user                    = pick($facts.dig('puppet_settings','server','user'),$facts.dig('puppet_settings','master','user')),
  String                         $group                   = pick($facts.dig('puppet_settings','server','group'),$facts.dig('puppet_settings','master','group')),
  Boolean                        $mock                    = false
) inherits pupmod {

  include 'pupmod::master::service'

  unless $mock {
    if ($server_distribution == 'PE') or defined(Class['puppet_enterprise::profile::master']) {
      # If this is PE use the PE default for this run since the variable won't exist
      $_tuning_max_active_instances = max(($facts['processors']['count'] - 1), 1)
    } else {
      $_tuning_max_active_instances = $pupmod::master::max_active_instances
    }
    $_java_max_memory = $java_max_memory.lest || { pupmod::java_max_memory($_tuning_max_active_instances) }


    # In Puppet 6.19 the section "master was renamed to "server" in Puppet.settings.
    # pick is used here to determine correct value for backwards compatability
    $_server_datadir = pick($facts.dig('puppet_settings','server','server_datadir'),$facts.dig('puppet_settings','master','server_datadir'))

    $_java_temp_dir = $java_temp_dir.empty ? {
      # puppet_settings.master.server_datadir is not always present, but its parent is
      true    => "${_server_datadir.dirname}/pserver_tmp",
      default => $java_temp_dir,
    }

    file { $_java_temp_dir:
      ensure => 'directory',
      owner  => $user,
      group  => $group,
      mode   => '0750'
    }

    if ($server_distribution == 'PE') {
      if 'pe_build' in $facts.keys {
        if (SemVer($facts['pe_build']) < SemVer('2016.4.0')) {
          ['JAVA_ARGS', 'JAVA_ARGS_CLI'].each |String $setting| {
            pe_ini_subsetting { "pupmod::master::sysconfig::javatempdir for ${setting}":
              path              => '/etc/sysconfig/pe-puppetserver',
              section           => '',
              setting           => $setting,
              subsetting        => '-Djava.io.tmpdir',
              quote_char        => '"',
              value             => "=${_java_temp_dir}",
              key_val_separator => '=',
              notify            => Class['pupmod::master::service']
            }
          }
        }
      }
    }
    else {
      # Use alternate jruby file  only if file exists
      # in the installation directory defined in the puppetserver_jruby fact.
      if $jruby_jar != 'default' and $facts['puppetserver_jruby'] {
        $_jruby_jar = member($facts['puppetserver_jruby']['jarfiles'], $jruby_jar) ? {
          true  => "${facts['puppetserver_jruby']['dir']}/${jruby_jar}",
          false => 'default'
        }
      } else {
        $_jruby_jar = 'default'
      }

      file { "/etc/sysconfig/${pupmod::master::service::service_name}":
        owner   => 'root',
        group   => $group,
        mode    => '0640',
        content => epp("${module_name}/etc/sysconfig/puppetserver"),
        notify  => Class['pupmod::master::service']
      }
    }
  }
}