building or appending to an array using a lambda in Puppet

Tripped over a challenge shifting KVM guest definitions into hiera. I’m using the cirrax/libvirt module which offers up this way to define a guest.  (I’ve modified the example in the module documentation.) libvirt::domain { ‘my-domain’: max_memory => ‘2000’, cpus => 2, boot => ‘hd’, disks => [{‘type’ => ‘file’, ‘device’ => ‘disk’, ‘source’ => {‘dev’ […]

puppet apply #8 – puppet apply and hiera

Adding classes At present, puppet apply should look something like this: $ sudo scripts/puppetapply.sh + /opt/puppetlabs/bin/puppet apply –test –environment=local /etc/puppetlabs/code/environments/local/manifests Info: Loading facts Notice: Compiled catalog for clientname in environment local in 0.16 seconds Info: Applying configuration version ‘xxx’ Notice: Applied catalog in 0.09 seconds Let’s add back in the clientscope class. This will populate […]

puppet apply #7 – classification via hiera

Hiera introduction Hiera is used to store data. Roles and profiles are about code reusability, and separating data and code is probably the other main pillar of Puppet best practise. Hiera layers the data, allowing you to selectively mask values with others based on properties of the puppet client.  The trick is to pick useful […]

puppet apply #5 – roles and profiles

what are roles and profiles? Roles and profiles are the recommended way from Puppet to organise code. Documentation elsewhere on this includes: https://puppet.com/docs/pe/2017.2/r_n_p_full_example.html Summary: Each node / server / puppet agent has a single role. Webserver, database server, jenkins server, blog-webserver, customer-databaseserver, and so on.  Whatever makes sense in your environment. Profiles provide useful functionality […]

puppet apply #4 – a profile

Putting all our code in site.pp isn’t very scalable. We want to follow Puppet best practise and use roles and profiles, so: cd control-repo # I’m going to assume this from now on git checkout puppetapply02 If you look at manifests/site.pp, there’s an include statement. This is the basis of how node classification is generally done. […]