puppet_agent_settings

pdk
Add facts to expose puppet agent settings

9,416 downloads

1,524 latest version

5.0 quality score

Version information

  • 0.1.4 (latest)
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Mar 20th 2025
This version is compatible with:
  • Puppet Enterprise 2025.4.x, 2025.3.x, 2025.2.x, 2025.1.x, 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 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 < 9.0.0
  • RedHat, CentOS, Solaris, SLES, Debian, Ubuntu, Gentoo, AIX, Windows, OSX

Start using this module

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

Add this module to your Puppetfile:

mod 'laura-puppet_agent_settings', '0.1.4'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add laura-puppet_agent_settings
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install laura-puppet_agent_settings --version 0.1.4

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

laura/puppet_agent_settings — version 0.1.4 Mar 20th 2025

Puppet Agent Settings Facts

This module adds Puppet agent settings facts:

[root@master ~]# facter -p puppet_agent_settings
{
  config => "/etc/puppetlabs/puppet/puppet.conf",
  confdir => "/etc/puppetlabs/puppet",
  hostcert => "/etc/puppetlabs/puppet/ssl/certs/blah.pem",
  hostprivkey => "/etc/puppetlabs/puppet/ssl/private_keys/blah.pem",
  hostpubkey => "/etc/puppetlabs/puppet/ssl/public_keys/blah.pem",
  localcacert => "/etc/puppetlabs/puppet/ssl/certs/ca.pem",
  pluginfactdest => "/opt/puppetlabs/puppet/cache/facts.d",
  resubmit_facts => false,
  ssldir => "/etc/puppetlabs/puppet/ssl",
}

Why not use the settings variable?

[root@master ~]# puppet apply -e 'notice($settings::confdir)'
Notice: Scope(Class[main]): /etc/puppetlabs/puppet
Notice: Compiled catalog for master.lmacchi.vm in environment production in 0.21 seconds
Notice: Applied catalog in 0.29 seconds
[root@master ~]# puppet apply -e 'notice($settings::config)'
Notice: Scope(Class[main]): /etc/puppetlabs/puppet/puppet.conf
Notice: Compiled catalog for master.lmacchi.vm in environment production in 0.23 seconds
Notice: Applied catalog in 0.37 seconds
[root@master ~]# puppet apply -e 'notice($settings::ssldir)'
Notice: Scope(Class[main]): /etc/puppetlabs/puppet/ssl
Notice: Compiled catalog for master.lmacchi.vm in environment production in 0.20 seconds
Notice: Applied catalog in 0.32 seconds

As explained in the Puppet docs, the settings variable return values from the master, which is always Linux. This module returns paths from the agent, which are different for Windows agents.

How do I see all Puppet agent settings?

16:50:12 root@blah ~ # puppet config print
agent_catalog_run_lockfile = /opt/puppetlabs/puppet/cache/state/agent_catalog_run.lock
agent_disabled_lockfile = /opt/puppetlabs/puppet/cache/state/agent_disabled.lock
allow_duplicate_certs = false
allow_pson_serialization = true
always_retry_plugins = true
autoflush = true
[...]

Are all of those available in this module as facts?

No, I selected some that I've needed while writing code and some requested via pull request. I haven't been very diligent about checking for PRs, but hope to change that!

In order to get an up to date list of available facts, check the code under 'lib/facter'.

As of this writing:

settings = ['config', 'confdir', 'ssldir', 'hostprivkey', 'hostpubkey', 'localcacert', 'hostcert', 'resubmit_facts', 'pluginfactdest']

Example

ini_setting { 'Change runinterval in puppet.conf':
  ensure  => present,
  section => 'agent',
  setting => 'runinterval',
  value   => '2h',
  path    => $facts['puppet_agent_settings']['config'],
}

2025 update

Puppet has added some agent settings into the core product, more details here