CodingBee

A beginners guide to programming and automating stuff

All posts in Puppet

Puppet – querying puppetdb with postgres command line (psql)

Exported Resources https://docs.puppet.com/puppet/latest/reference/lang_collectors.html https://docs.puppet.com/pe/latest/node_deactivation.html querying puppetdb with postgres command line, psql psql -h localhost -U puppetdb puppetdb However to connect to puppet enterprise’s puppetdb, then follow: https://gist.github.com/tnolet/7133083 \q \h \l \d select * FROM catalog_resources \X \x SELECT * FROM catalog_resourcesSELECT * FROM factsselect * from factsssselect * from reports . . . Read more

Puppet – PuppetDB

http://docs.puppetlabs.com/puppetdb/latest/ https://github.com/spotify/puppetexplorer

Puppet – The Puppet Narrative (learning technique)

The fastest way to learn Puppet is to get a full picture of the puppet infrastrucutre. The best way to do to this is if you have a story (aka narrative) to follow along that starts from the puppet basics to the advanced stuff. When you learn something new about . . . Read more

Puppet – External Facts

External facts is a great way to apply (arbitary) meta data to a vm during the vm provisioning stage (e.g. using vsphere/openstack/aws….etc). These meta data can then be used by puppet to determine what needs to be added into the catalog. it’s really simple to create an external fact: step . . . Read more

Puppet – Ordering using “Run Stages”

So far we have looked at order resources, and ordering classes. Run Stages let you do ordering at a higher level. https://docs.puppetlabs.com/puppet/latest/reference/lang_run_stages.html

Puppet – Ordering your classes

this is common, for example, sometimes once class installs dbg software, and then the next class creates the db istself. class mainclass { include class1 include class2 include class3 include class4 Class[‘class1’] -> Class[‘class2’] -> Class[‘class3’] -> Class[‘class4’] }

Puppet – r10k and the Puppetfile

The “Puppetfile” is list of all puppet modules you want downloaded into your puppet master’s modules folder: The first line of this file should be: forge “http://forge.puppetlabs.com” After that any puppet forge modules are listed as: mod ‘puppetlabs/stdlib’, ‘4.5.1’ Next any puppet modules hosted on git (e.g. github or any . . . Read more

Puppet – Setting user password

When you use the user resource, you’ll notice that it contains a password attribute. This can only be used to enter an encrypted password, aka a hashed password. For security reasons, you cannot use a plain text password. Also for some reason, you can’t use the passwd command to create . . . Read more

Puppet – r10k.yaml

https://docs.puppetlabs.com/pe/latest/r10k_yaml.html r10k comes with it’s own config file which is usually in: $ cd /etc/puppet # note you have to cd into this folder first. $ cat /etc/puppet/r10k.yaml. # note, you have to create this file if it doesn’t already exist. :cachedir: ‘/var/cache/r10k’ :sources: puppet: remote: http://{github url that contains . . . Read more

Puppet – Using Augeasproviders

While the augeas resource type is really powerful, it is relatively complicated to craft an augeas resource types. There are a few puppet modules that run on top of augeas and simplifies the use of augeas by providing custom resource types for editing specific config files: http://augeasproviders.com/documentation/examples.html I think the . . . Read more