Puppet Course - Day 3 Notes

Largely practical today, so less theory notes etc than previous days.

External Facts

./modules/${module}/facts.d/
You can download additional facts to be collected during a puppet run.
This directory resides on the puppet master

/lib/facter/*.rb -
Custom facts - to be deployed to each of the clients

  • Can be deployed using Puppet
Inherited Classes

It is possible to inherit classes, however this makes the code difficult to traverse when troubleshooting

Hiera
  • Hiera files are always retained on the master, they are used to generate config used by the nodes (which then retrieve the code to execute locally)
  • Hierarchical adoption of parameters, highest priority is node, then traversal of hierarchy all the way to global parameters.
  • i.e. if ntp-server = ntp1.sydney.company.com (in global data file) and ntp1.china.company.com (in site or node hiera data file), the localised one would take precedence (ntp1.china.company.com).
validation of hiera data

hiera -c can be used to query hiera data

Encrypted YAML

eyaml will allow generation of encrypted data (using your local keys)
https://github.com/TomPoulton/hiera-eyaml

Puppet Module Tool

This can be used for

  • automatically generating directory structure (manifests, files, examples etc)
  • Attaining sample code
  • Attaining documentation

puppet module install {module} is the pmt command syntax

  • Only a single package can be used at a time
  • R10K is another useful tool for this, however the course doesn't cover it. Perhaps another day...