Ask Your Question

How can I apply the most recently generated catalog? ie, agent with "cahceonly" mode?

asked 2017-02-27 04:10:23 -0600

otheus gravatar image

Our setup is a puppet-master with foreman and running puppet agent in cron. The agent compiles the catalog and applies it. Is it possible to re-apply the most recently generated catalog? An obvious use case is to generate the catalog daily, and reapply it more periodically; another use-case is for testing purposes to modify the json-catalog file and re-apply it. Another use-case is to use puppet apply with parameters.

The following solution does not work: puppet apply --verbose --catalog /var/lib/puppet/client_data/catalog/$HOSTNAME.json. Well, it runs, but it actually seems to apply nothing.

Info: Loading facts Notice: Compiled catalog for in environment development_c10267 in 0.01 seconds Info: Applying configuration version '1488186342' Notice: Finished catalog run in 0.39 seconds

Another problematic solution is: puppet catalog apply --terminus json. It is problematic because there is no control for command-line parameters as there is with agent and apply, ie, --tags , --noop, etc. It is also problematic because after the run, it spits out to stdout the entire json catalog, making it very difficult to see what failed.

FYI: # puppet --version 3.8.7

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-02-27 04:29:19 -0600

otheus gravatar image

The best answer appears to be the --use_cached_catalog option with agent subcommand:

puppet agent -t --noop --tags=system::services --use_cached_catalog

This could be used, for instance, to ensure critical services are running, without tasking the master.

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


Asked: 2017-02-27 04:10:23 -0600

Seen: 44 times

Last updated: Feb 27 '17