Your exec has output you want puppet to log or silently ignore.
class exec_logging {
# on_failure logs the commands output on failure
exec { 'delete_str_tmp':
path => '/usr/local/bin/:/bin:/usr/sbin',
command => 'find /tmp/ -name \'*.str\' -type f | xargs -n 1 rm',
logoutput => 'on_failure',
}
}
When an exec
runs a command that has output it can be handled by
puppet in a number of different ways. If you want the output to be
logged (and then passed back in reports or to Dashboard) you can specify
logoutput => true,
(note - the true isn't quoted). If you want the
command to be silent even on failure (puppet will still show an error if
the exec fails) you can specify logoutput => false
. Otherwise if you
only care about the output when something breaks (as we often do) you
can pass the string on_failure
to logoutput
.