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 =

puppet apply???

*Apply sub-command in Puppet "puppet apply"*

This is the standalone puppet execution tool which is used to apply individual manifests.

It is an application that complies and manages configuration on node.


Point to note is puppet apply never runs as a daemon like puppet agent. It always runs like a single process which complies a catalog then applies it send a report that's it.

Most important option with puppet apply command is modulepath.

Suppose you are firing puppet apply XYZ.pp file then it will take the module location as /etc/puppet/modules by default but if in case your modules are there in some other directory suppose /root/puppet-modules then you can use "modulepath" with this location to ask puppet to use it.

Running a puppet apply command to apply the changes to the machine with site.pp manifest.

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

Now suppose you want to include some remote modules then you can use:

[root@puppet manifests]# puppet apply site.pp --modulepath=/root/puppet-modules/
notice: Finished catalog run in 0.46 seconds
[root@puppet manifests]#

Ask puppet to create a log file for your transaction:

[root@puppet manifests]# puppet apply -l /tmp/puppet_manifest.log site.pp

Suppose you want to execute a module on the machine.

[root@puppet manifests]# puppet apply -e "include sudo"
notice: Finished catalog run in 0.22 seconds
[root@puppet manifests]#

If your module is at some other location then you can add --modulepath in it.

[root@puppet manifests]# puppet apply -e "include ssh" --modulepath=/root/puppet-modules/
notice: Finished catalog run in 0.15 seconds
[root@puppet manifests]#

Comments

Popular posts from this blog

Exec in Puppet

Un-revoke the revoked certificate in Puppet

Dry run in Puppet --noop