Ask Your Question

Best way to run script on every node after apply?

asked 2015-05-11 17:06:15 -0600

clink gravatar image

I need to run a script after every puppet run. What is the best way of doing this? For example, let's say the script is /usr/bin/ and that script needs to be called on every node after a puppet run. I know how to inclue in every init.pp file, but figure there is a better approach to this.

Just read above and want to clarify a bit. Say I have 20 nodes. Any time a puppet run is done on any node, I need to run on that node. I hope that is clear.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-11 19:41:44 -0600

csharpsteen gravatar image

Check out the postrun_command setting:

A command to run after every agent run. If this command returns a non-zero return code, the entire Puppet run will be considered to have failed, even though it might have performed work during the normal run.

So, something like the following in puppet.conf should work:

postrun_command = /usr/bin/
edit flag offensive delete link more


Cool, I didn't know about that one.

JohnsonEarls gravatar imageJohnsonEarls ( 2015-05-11 19:57:03 -0600 )edit

Thanks so much. I will give this a try, but it looks perfect!

clink gravatar imageclink ( 2015-05-12 11:09:43 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2015-05-11 17:06:15 -0600

Seen: 73 times

Last updated: May 11 '15