Puppet Function: peadm::generate_pe_conf
- Defined in:
- functions/generate_pe_conf.pp
- Function type:
- Puppet Language
Overview
Generates a pe.conf file, removing undef parameters
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 |
# File 'functions/generate_pe_conf.pp', line 8
function peadm::generate_pe_conf (
Hash $settings,
) {
# Check that console_admin_password is present
unless $settings['console_admin_password'] =~ String {
fail('pe.conf must have the console_admin_password set')
}
# Define the configuration settings that will be placed in pe.conf by
# default. These can be overriden by user-supplied values in the $settings
# hash.
$defaults = {
'puppet_enterprise::profile::master::java_args' => {
'Xmx' => '2048m',
'Xms' => '512m',
},
'puppet_enterprise::profile::console::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
'puppet_enterprise::profile::orchestrator::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
'puppet_enterprise::profile::puppetdb::java_args' => {
'Xmx' => '768m',
'Xms' => '256m',
},
}
# Merge the defaults with user-supplied settings, remove anything that is
# undef, then output to JSON (and therefore HOCON, because HOCON is a
# superset of JSON)
($defaults + $settings).filter |$key,$value| {
$value != undef
}.to_json_pretty()
}
|