Search code examples
bashpuppet

Echo messages from a script run by Puppet


I am writing a bash script that will be run by puppet by an Exec resource (I know. It is not ideal). I would like to know if is possible create debug messages in the script. Normally in Bash I use echo and in a manifest I use notify. But echo seems not work when the script is executed as an Exec resource in Puppet.


Solution

  • Check the documentation here for the logoutput attribute: https://docs.puppet.com/puppet/latest/reference/types/exec.html#exec-attribute-logoutput

    You can always see the output from your echo in the script during Puppet agent execution with logoutput set to true.

    For example:

    exec { '/bin/sh script.sh': logoutput => true }