Ask Your Question

How do I combine --noop and --detailed-exitcodes ?

asked 2013-01-23 03:46:47 -0500

chmac gravatar image

I'd like to disable the puppet agent and roll out changes manually. I'm only managing a few servers. However, to ensure things are kept up to date, I'd like to schedule a cron job which will notify me if there are changes outstanding.

I did some research and figured I could probably try something like puppet agent --test --noop --detailed-exitcodes. However, that always exits 0, while puppet agent --test --detailed-exitcodes does produces a meaningful exit code.

Short of grepping the output of puppet agent --test --noop is there a more elegant way to achieve my goal?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-02-01 13:01:08 -0500

nanliu gravatar image

Detailed exitcode can only give you so much info. The information you are looking for is available in report metrics, and you can parse lastrunfile (see the option). This is the example output in from mcollective puppetd summary (which scrapes this file for this data, and for noop run will have pending metrics):

sudo -u peadmin /usr/local/bin/mco puppetd summary --with-class 'mysql'

 * [ ============================================================> ] 3 / 3

   Resources: {"failed"=>2,
     Changes: {"total"=>0}
      Events: {"success"=>0, "total"=>2, "failure"=>2}
    Versions: {"config"=>1359743684, "puppet"=>"2 ...
edit flag offensive delete link more

answered 2013-01-23 10:33:41 -0500

JoshCody gravatar image

Take a look at Reporting which happens each run, noop or otherwise. Then, you can use tools like PuppetDB or Puppet Dashboard to find nodes that are out of date.

For a more robust solution, you can implement deeper orchestration with MCollective which allows you to target machines by classes, tags and facts.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2013-01-23 03:46:47 -0500

Seen: 367 times

Last updated: Feb 01 '13