Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to print out messages to the console before executing a command in puppet. For example, let's say my manifest has:

exec {
    command => 'mycommandhere'

I would like to print a message that says 'Running my command'. Is there an easy way to do this, other than calling another command before it that does the print out?

share|improve this question
Is there some reason why you don't just call puppet with the --debug option? – Zoredache Mar 1 '12 at 5:20
Didn't think of that -- I'm still pretty new to puppet. thanks. – Jeff Storey Mar 1 '12 at 13:34
up vote 6 down vote accepted

Sure, just chain two resources together:

notify { 'some-command':
  message => 'some-command is going to be executed now'

exec { 'some-command':
  command => '/path/to/some-command',

Notify['some-command'] -> Exec['some-command']
share|improve this answer
Thanks for the reply. – Jeff Storey Mar 21 '12 at 4:52

There is no way to write your puppet manifest to print a message exactly before your exec resource other than making it a part of the exec. For the general case of printing messages, look at notify. For your specific case, perhaps running puppet in verbose or debug mode will work.

share|improve this answer

You can use notice() or warning() (depending on what you want to tell the user)

notice( 'some-command is going to be executed now' )

and then simply exec right after that line.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.