This post contains few important concepts associated with puppet which I noted while learning puppet

puppet config print all

The above command lists all the puppet configurations on the server.

By default puppet agent tries to call the master hostname “puppet” if you don’t specify the FQDN in the server parameter.

The puppet server sends the compiled catalog to the client in PSON format.

You can test the puppet code locally using puppet apply command with the relevant manifest path as shown below.

puppet apply /etc/puppet/manifests/site.pp

You can also execute the puppet DSL using puppet apply command as follows.

puppet apply –e "package { 'apache2': ensure => present }"

You can get the details about a puppet resource using the following command.

puppet describe

You can list all the users on a puppet agent using the following command.

puppet resource user

The faster data can be called inside a module using the following syntax.

$mysql_service_name = $::osfamily ? {
 'RedHat' => 'mysqld',
 default => 'mysql',

Puppet class variables can be added as string, boolean , hash and array in the following manner.

$package = 'mysql'
$installed = true
$backend_servers = [ '' , '' ]
$admin = { user => 'bibin', group => 'admin' }

You cannot update the variable value in the same class. For example, the following variable declaration would throw an error.

$num = '1'
$num = $num + 1


You can use a variable in puppet in the following.

Puppet DSL’s (modules, site.pp)
ENC (External Node Classifier)

Puppet Built-in Variables


Inside the environment manifest directory, you can create a .pp file with the certname name of the node and it will be read by the puppet master automatically. In other terms, puppet master read all the .pp files in the environment manifest directory. By this, you will have a clean site.pp file with all node related code going into the relevant node.pp file.