Forge Home

puppet_conf

Manage puppet.conf flexibly

4,486 downloads

3,522 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.3 (latest)
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Feb 16th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , , , , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'spy-puppet_conf', '1.0.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add spy-puppet_conf
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install spy-puppet_conf --version 1.0.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

spy/puppet_conf — version 1.0.3 Feb 16th 2020

Manage puppet.conf

Table of Contents

  1. Description
  2. Setup - The basics of getting started with puppet_conf
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Licensing information

Description

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.

Setup

Setup Requirements

This module depends on the puppetlabs/inifile module.

Beginning with puppet_conf

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',
}

Usage

puppet_conf resource type

The puppet_conf resource type has three attributes:

  • name (namevar) – setting to manage, in section/setting notation;
  • ensure (default: present) – manages a setting as present or absent;
  • value – value for the setting; if set to undef, 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.

puppet_conf class

The puppet_conf class has two attributes:

  • purge_unmanaged (default: false) – purge unmanaged entries from puppet.conf;
  • entries (default: {}) – hash of section-keyed setting-value hashes; use undef (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.

Examples

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

Limitations

The puppet_conf resource type is a thin syntactic sugar wrapper around the ini_setting type; all of its limitations and incompatibilities apply.

License

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.