How to detect that a puppet run is complete
Asked Answered
S

2

7

I need a way to detect that puppet has finished an initial run ( successfully ), so I can wait before launching other actions when spinning up machines on AWS EC2 and/or OpenStack. How can I check this?

Some ideas floated so far are:

  1. have puppet touch a file when finished ( successfully ), I can then just watch for that file
  2. have puppet write a fact when finished (successfully ), I can check facts through mcollective. ( Not sure if writing to puppet db from within a puppet run is even possible )
Sylph answered 1/11, 2013 at 18:22 Comment(0)
H
6
/var/lib/puppet/state/puppetdlock
/var/lib/puppet/state/state.yaml
/var/lib/puppet/state/last_run_summary.yaml

These are the files you want to check.

The lock file is set if puppetd is currently running. State and last_run_summary can be used to see if past runs have succeeded or not.

See also this serverfault question:

https://serverfault.com/questions/463231/check-if-puppet-agent-is-up-to-date

Henandchickens answered 1/11, 2013 at 22:2 Comment(1)
If your using Puppet Enterprise these files are normally found under /var/opt/lib/pe-puppet/state. Use puppet config print vardir to find the directory if you installed at a custom locationJehius
P
1

I have try it on CentOS 6.4

If you run Server/Client mode, check the file exist:

/var/lib/puppet/state/agent_catalog_run.lock

If you run it in standalone, I don't find there exist a lock file. Maybe you need to parse the log file for this item "Finished catalog run in xxx seconds"

Pennyworth answered 2/11, 2013 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.