Pages - Menu

Pages

Wednesday, August 20, 2014

How to get the Current File location of a Puppet Manifest

Puppet is an excellent configuration automation scripting language that is really flexible and effective,

In a puppet manifest if you are not running your script in the default puppet directory you may need to get the current Manifest location where its running from, So this can be easily achieved by embedding a ruby code snippets within the manifest it self. The code will look like the following.

$var1 = inline_template("<%= Dir.pwd %>")

notice ("This Current Location : ${var1}")


The output will look like the following,

Notice: Scope(Class[main]): This Current Location  /home/yasassri/Desktop/QA_Resources/puppet/mySCripts/ascluster
Notice: Compiled catalog for yasassri-thinkpad-t540p.private.wso2.com in environment production in 0.01 seconds
Notice: Finished catalog run in 0.03 seconds