Manage Puppet agent on Windows

puppet.conf

As you may already know Puppet works in server – agent architecture. Hence, you will most likely maintain one or more Puppet server, and many Puppet agents, as many as servers in your environment to be configured by Puppet. How can I manage Puppet agent on Windows? This question we are trying to address here.

Manage Puppet agent

There are couple items to consider when you think about Puppet agent. Firstly, the Puppet server that Puppet agent will communicate to. Secondly, the environment Puppet agent will use, and based on this fact what modules are going to be applied to host where Puppet agent operates. Last but not least, the interval at which Puppet agent runs as a service on the Puppet node.

All those parameters should be part of puppet.cont for every Puppet agent. You must decide how are they going to be applied, and further how are you going to manage any modifications that is required going forward. The environment parameter should be treated as special case. It can be set, and controlled by Puppet agent itself, but it’s not only option you can choose from. You can use Puppet server to control and propagate desired environment value to Puppet agent. ENC was developed to support this option More to read about that in another post. Whatever option you chose, setting of proper environment in puppt.conf of Puppet agent should be considered as best practice.

puppet.conf

Basic puppet.conf should look like as below. It will be manageable in environments with medium to large amount of Puppet agents.

[main]
server=<%= @puppet_master %>
autoflush=true
environment=<%= @server_facts['environment'] %>
runinterval=<%= @puppet_agent_runinterval %>

Puppet agent version

Below is just an example of piece of code that can be included in one of the Puppet modules to manage Puppet version on Windows. Once it is configured, puppet agent upgrade is pretty straightforward exercise across whole Windows environment.

package {'Puppet Agent (64-bit)':
  provider => 'windows',
  ensure => $puppet_agent_version,
  source => "${scriptspath}\\puppet-agent-${puppet_agent_version}-x64.msi",
  install_options => [ { 'PUPPET_AGENT_STARTUP_MODE' => 'AUTO' }, '/quiet'],
}

Hiera data

After setting Puppet as above you have overall control over those specific Puppet agent parameters from one central location, which is hiera data.

puppet_master: "puppetmaster.%{domain}"
puppet_agent_version: '6.13.0'
puppet_agent_runinterval: '900'

References:

Leave a Reply

Your email address will not be published. Required fields are marked *