Puppet Smoke Tests and Real Time Run

Thinknyx Configuration Management “Puppet Series”: for those who want to start with the base can go through below blogs first.
Start Automation with Puppet
Puppet Enterprise Stack
Puppet Enterprise Master Installation
Puppet Agent Installation
Puppet Master-Agent Communication Model
Puppet Certification Management
Puppet Resources
Puppet Resources-II
Puppet Code Syntax Checks


Before moving to Puppet Classes, its time to see how code deployments actually takes place with Puppet Codes. We will see how the Smoke tests and Real Puppet run can be checked and applied “locally where we have written the code i.e local test environment” and “on puppet clients”.

Local Smoke Tests and Real Puppet Run:

Take the below example code as a reference:

# cat /etc/puppetlabs/code/environments/production/manifests/thinknyx.pp
user { ‘thinknyx’:
ensure => ‘present’,
home => ‘/home/thinknyx’,
managehome => ‘true’
Smoke Test Locally: Puppet apply <code-path> –noop
where noop -> no operation mode

This command will not perform any of the tasks written in Puppet Code, but will only indicates what all configuration is available to apply on system (what new configuration is present or what all deflection have been there since last Puppet Run on the client with reference to the configuration configured in the Puppet Master).

# puppet apply /etc/puppetlabs/code/environments/production/manifests/thinknyx.pp –noop
Notice: Compiled catalog for learning.puppetlabs.vm in environment production in 0.04 seconds
Notice: /Stage[main]/Main/User[thinknyx]/ensure: current_value absent, should be present (noop)
Notice: Class[Main]: Would have triggered ‘refresh’ from 1 events
Notice: Stage[main]: Would have triggered ‘refresh’ from 1 events
Notice: Applied catalog in 0.58 seconds

# id thinknyx
id: thinknyx: no such user

Real Time Puppet Run Locally: Now we will run the real time Puppet which will configure the configuration we have defined. We will check the local run first to ensure all will work fine in production. Usually the Experts who creates any Puppet Code performs this task locally in their own test environment and then merge the code in the Main Master Branch (using Version Control System) for Production use.

# puppet apply /etc/puppetlabs/code/environments/production/manifests/thinknyx.pp -tv
Info: Loading facts
Notice: Compiled catalog for learning.puppetlabs.vm in environment production in 0.04 seconds
Info: Applying configuration version ‘1477681424’
Notice: /Stage[main]/Main/User[thinknyx]/ensure: created
Notice: Applied catalog in 0.43 seconds

# id -a thinknyx
uid=1009(thinknyx) gid=1009(thinknyx) groups=1009(thinknyx)

Smoke Test on Client: Before applying the configuration code on any of the client its always recommendable to get it run in the “nooperation” mode. Puppet gives us the utility to run smoke tests on client before applying the configuration in real mode “puppet agent -tv –noop” where -t is for tests -v is for verbose and –noop is for nooperation test.

Real Time Puppet Run on Client: Once smoke test is successful we are confident to run the Puppet code in Real Mode by running Real Time Puppet Run We will be using the same when we move further with the Thinknyx Puppet Series.
In our next posts we will start Classes and learn about defining and declaring the classes for use in Puppet.

Leave a Comment

Your email address will not be published.