I want to print out messages and variables when Puppet runs. I saw there are two functions that might help but couldn't really use them. My site.pp
file:
info "running site.pp info" debug "running site.pp debug"
When I run on the client:
puppet -t
I don't get those prints.
Puppet agent is a core service that manages systems, with the help of a Puppet primary server. It requests a configuration catalog from a Puppet primary server server, then ensures that all resources in that catalog are in their desired state.
Log into your primary server or client tools workstation and run one of the following commands: To specify the query on the command line: puppet job run --query '<QUERY>' <OPTIONS> To pass the query in a text file: puppet job run --query @/path/to/file.
Configuring the debug session To debug a simple manifest in VS Code, press F5 and VS Code will try to debug your currently active manifest by running the equivalent of puppet apply . Note that by default No Operation ( --noop ) is enabled so that your local computer will not be modified.
Here is the puppet script with all the available puppet log functions.
node default { notice("try to run this script with -v and -d to see difference between log levels") notice("function documentation is available here: http://docs.puppetlabs.com/references/latest/function.html") notice("--------------------------------------------------------------------------") debug("this is debug. visible only with -d or --debug") info("this is info. visible only with -v or --verbose or -d or --debug") alert("this is alert. always visible") crit("this is crit. always visible") emerg("this is emerg. always visible") err("this is err. always visible") warning("and this is warning. always visible") notice("this is notice. always visible") #fail will break execution fail("this is fail. always visible. fail will break execution process") }
Script output (on puppet 2.7):
NB: puppet 3.x colours may alter (all the errors will be printed in red)!
from the Puppet function documentation
info: Log a message on the server at level info. debug: Log a message on the server at level debug.
You have to look a your puppetmaster logfile to find your info/debug messages.
You may use
notify{"The value is: ${yourvar}": }
to produce some output to your puppet client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With