Puppet Notes


Install module on Puppet Server

/opt/puppetlabs/bin/puppet module install <name of module>

Uninstall module on Puppet Server

/opt/puppetlabs/bin/puppet module uninstall <name of module>

Resource: https://www.puppetcookbook.com/posts/installing-modules-from-the-puppet-forge.html

List installed Modules

puppet module list

Resource: https://puppet.com/docs/puppet/5.3/modules_installing.html

Change module install path

By default, puppet module install installs modules into the first directory in the Puppet modulepath, which defaults to $codedir/environments/production/modules.

To change this, set the modulepath in /etc/puppetlabs/code/environments/{environment_name}/environment.conf

Resource: https://serverfault.com/questions/705623/install-a-puppet-module-to-the-global-modules-directory-by-default

List all agents connected to server

puppetserver ca list --all

For puppermasters (older):

puppet cert list --all

Get the information from site.pp:

grep -io 'node .* ' /etc/puppet/manifests/site.pp 


Remove agent from server

puppetserver ca clean --certname <name of node>

Install multiple dependencies


class base (){


class base::packages inherits base {
  ].each |$pkg| {
    package { $pkg:
      ensure   => latest,
      name     => $pkg,
      provider => 'yum'

Output machine info

notify { 'Machine Information':
  name     => 'mach_info',
  message  => "Running on ${::hostname} in the ${::environment} environment",
  withpath => true,