Puppet motd template


1) Create the manifest of sys_motd module/etc/puppet/environments/development/modules/sys_motd/manifests/init.ppclass sys_motd { file { '/etc/motd': ensure => file, content => template('sys_motd/motd.erb'), }}2) Create a ERB file as the motd template/etc/puppet/environments/development/modules/sys_motd/templates/motd.erb#################################HOST: <%= fqdn %> OS: <%= operatingsystem %> VERSION: <%= operatingsystemrelease %> ENVIRONMENT: <%= environment %>#################################

Puppet custom facter


In my lab, I added a custom facter 'environment', which tells me the box is in either development or production.Here are the steps1) Create a new module and associated file: /etc/puppet/modules/mylab/lib/facter/environment.rb2) Add the ruby code:# Add puppet facter environmentFacter.add("environment") do setcode do result = case Facter.hostname when /^dev/: "development" else "production" end result endendReference:https://docs.puppetlabs.com/facter/2.2/custom_facts.html 

Puppet cron job configuration


In my lab, I want everything to be controlled by puppet. So I use puppet to set up the cron job that I mentioned in step 3) in the post Integrate puppet to foreman.# Push puppet node facts to foreman*/10 * * * * /etc/puppet/push_facts.rbThe manifest can be found here as well.class sys_cron::push_facts {cron { puppet_push_facts: … Continue reading Puppet cron job configuration