Search code examples
puppet

Notify in verbose or debug mode only


I'm looking for a way to display a notify { ... } message during puppet client run only when using

  • puppet apply <--verbose | --debug>
  • puppet agent <--verbose | --debug>

I'd like to display debug messages when interactively/manually running puppet on clients. Yet, I couldn't find a way to evaluate these switches in my puppet manifests. How could I achieve this for puppet 4.x?


Solution

  • All Puppet resources support the loglevel metaparameter, including notify. Set it to debug to make a resource report on that level.

    notify { "this is a debug message": loglevel => "debug" }
    

    Output from such resources is hidden by default.

    The verbose option does not imply a specific log level.