- Description
- Setup - The basics of getting started with puppet_conf
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Licensing information
This Puppet module provides a puppet_conf
resource type for managing the puppet.conf
configuration file on a per-entry basis.
The module also supplies a puppet_conf
class for convenient Hiera-based management of Puppet configuration across infrastructure.
This module depends on the puppetlabs/inifile module.
The puppet_conf
type operates on the configuration file determined by the puppet_config
fact.
The following example manages a runinterval
entry of value 15m
in the [agent]
section:
puppet_conf { 'agent/runinterval':
value => '15m',
}
The puppet_conf
resource type has three attributes:
name
(namevar) – setting to manage, insection/setting
notation;ensure
(default:present
) – manages a setting aspresent
orabsent
;value
– value for the setting; if set toundef
, the behavior is to remove the setting.
This resource type may serve as an example of implementing a child provider as described in documentation to the puppetlabs/inifile module.
The puppet_conf
class has two attributes:
purge_unmanaged
(default:false
) – purge unmanaged entries frompuppet.conf
;entries
(default:{}
) – hash of section-keyed setting-value hashes; useundef
(null
or~
in Hiera) for a value to remove a setting.
Please look at the last two examples below to get a visual idea of what the entries
hash would look like.
Remember the last used environment:
puppet_conf { 'main/environment':
value => $server_facts['environment'],
}
Remove a configuration entry:
puppet_conf { 'main/static_catalogs':
ensure => absent,
}
Purge all settings not explicitly managed by Puppet:
resources { 'puppet_conf':
purge => true,
}
Manage several settings in different sections via the helper class using a nested hash:
class { 'puppet_conf':
entries => {
'main' => {
'environment' => 'production',
'strict_variables' => true,
},
'agent' => {
'certname' => 'example.com',
'runinterval' => '15m',
},
},
}
Store complete Puppet configuration in Hiera with deep merging (relevant parts only):
# manifests/site.pp - entryway manifest
hiera_include('classes')
# common.yaml - Hiera top-level settings
classes:
- puppet_conf
lookup_options:
puppet_conf::entries:
merge:
strategy: deep
puppet_conf::purge_unmanaged: true
puppet_conf::entries:
main:
server: puppet.example.com
environment: production
strict_variables: true
agent:
certname: "%{::trusted.certname}"
runinterval: 15m
# nodes/dev.yaml - node-specific settings
# deep merge strategy will override the corresponding
# environment setting from the top-level common.yaml
# (given that per-node configurations take precedence)
puppet_conf::entries:
main:
environment: development
The puppet_conf
resource type is a thin syntactic sugar wrapper around the ini_setting
type; all of its limitations and incompatibilities apply.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.