Featured Post

Directory environments in Puppet

Environments are individual groups of Puppet agents each environment have there own completely different manifests and module-paths. This basically is useful for testing changes to our Puppet code before implementing them on production machines. There are two types of implementation of environments structure in Puppet one if directory based and another is config file based here we will see bit of an insight about directory based. As usual for more information about this you can visit puppetlabs official website. On the master node: Append following details in puppet.conf which is placed under /etc/puppet or /etc/puppetlabs/puppet:     Under [main] section add a variable called confdir with value as /etc/puppet or /etc/puppetlabs/puppet     confdir=/etc/puppet Then add information regarding environments/manifests and modulepath in it.      #environments     environmentpath = $confdir/environments     default_manfiest = $confdir/manifests     basemodulepath =

Dry run in Puppet --noop

 Dry run in puppet is a powerful feature given by puppet. This basically is used to test your Puppet manifests on any of the environment without actually making any changes to the machine.

To dry-run Puppet, --noop flag needs to be used.

Puppet’s ‘noop’ (no-operation) mode shows you what would happen, but actually doesn’t do anything :)

This basically helps us for debugging stuff.

For instance:

[root@puppet manifests]# puppet apply site.pp --noop
notice: /Stage[main]/Sudo/File[/etc/sudoers]/content: current_value {md5}e81452ad78198a79772447b1f2b3b614, should be {md5}e2d690ebe349d93efa84146eb854c987 (noop)
notice: Class[Sudo]: Would have triggered 'refresh' from 1 events
notice: /Stage[main]/Ssh::Service/Service[sshd]/ensure: current_value stopped, should be running (noop)
notice: Class[Ssh::Service]: Would have triggered 'refresh' from 1 events
notice: Stage[main]: Would have triggered 'refresh' from 2 events
notice: Finished catalog run in 2.75 seconds
[root@puppet manifests]#


First noop =>
notice: /Stage[main]/Sudo/File[/etc/sudoers]/content: current_value {md5}e81452ad78198a79772447b1f2b3b614, should be {md5}e2d690ebe349d93efa84146eb854c987 (noop)

Above value states that there will be some modification to the sudoers file which will be made once puppet is executed.

Second noop =>
notice: /Stage[main]/Ssh::Service/Service[sshd]/ensure: current_value stopped, should be running (noop)

Second one is sshd daemon will be triggered when puppet will be executed.

I am okay with both the changes which are going to happen to the machine, so what I will do is remove the --noop flag and run puppet.


[root@puppet manifests]# puppet apply site.pp
notice: /Stage[main]/Sudo/File[/etc/sudoers]/content: content changed '{md5}e81452ad78198a79772447b1f2b3b614' to '{md5}e2d690ebe349d93efa84146eb854c987'
notice: /Stage[main]/Ssh::Service/Service[sshd]/ensure: ensure changed 'stopped' to 'running'
notice: Finished catalog run in 0.54 seconds
[root@puppet manifests]#


Comments

Popular posts from this blog

Exec in Puppet

Un-revoke the revoked certificate in Puppet