Puppet Notes

From Federal Burro of Information
Jump to navigationJump to search

Puppet 4.10 Cheat

Server setup

set

https://apt.puppetlabs.com/

wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt update
sudo apt-get install aptitude
aptitude search puppet
sudo apt-get install puppetserver puppet-agent puppetdb puppetdb-termini
Setting up puppetdb (4.4.0-1puppetlabs1) ...
Config archive not found. Not proceeding with migration
PEM files in /etc/puppetlabs/puppetdb/ssl are missing, we will move them into place for you
Warning: Unable to find all puppet certificates to copy

  This tool requires the following certificates to exist:

  * /etc/puppetlabs/puppet/ssl/certs/ca.pem
  * /etc/puppetlabs/puppet/ssl/private_keys/pm.quadratic.net.pem
  * /etc/puppetlabs/puppet/ssl/certs/pm.quadratic.net.pem

  These files may be missing due to the fact that your host's Puppet
  certificates may not have been signed yet, probably due to the
  lack of a complete Puppet agent run. Try running puppet first, for
  example:

puppet agent --test

  Afterwards re-run this tool then restart PuppetDB to complete the SSL
  setup:

      puppetdb ssl-setup -f
Setting up puppetserver (2.7.2-1puppetlabs1) ...
usermod: no changes
Processing triggers for libc-bin (2.23-0ubuntu7) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...

edit /etc/default/puppetserver . get memory allocation right.

puppet config set server ip-10-0-1-55
puppet cert list

journalctl -f

Linux agent setup

puppet config set server ip-10-0-1-55
puppet config set environment production
puppet config set runinterval 300
puppet config set log_level info
puppet agent --server ip-10-0-1-55 --no-daemonize --verbose --onetime
puppet agent --server pm.lab --no-daemonize --verbose --onetime --debug

Windows agent setup

https://downloads.puppetlabs.com/windows/

https://downloads.puppetlabs.com/windows/puppet-agent-1.10.0-x64.msi

agent one off

puppet agent --verbose --debug --onetime --no-daemonize

rootmail alias + newaliases

    augeas { 'rootmail':
        context => "/files/etc/aliases",
        onlyif  => "match /files/etc/aliases/*[name='root'][value='$rootmail'] size == 0",
        changes => [
            "rm *[name='root']",
            "set 01/name root",
            "set *[name='root']/value $rootmail",
        ],
    }

    exec { 'newaliases':
        subscribe => Augeas['rootmail'],
        command => "/usr/bin/newaliases",
    }

relayhost

    augeas { 'relayhost':
        context => "/files/etc/postfix/main.cf",
        onlyif  => "match relayhost != '$relayhost'",
        changes => [
            "rm relayhost",
            "set relayhost '$relayhost'",
        ],
    }

Also See