Allow puppet to run in an offline mode that only uses the cache
|Affected Puppet version:||0.24.7||Branch:|
I’ve been poking at adding this feature for a while, so I thought I’d put in the feature request and see what the consensus is on what this option should be named, or whether there is violent disagreement as to whether it should exist.
I want the ability to tell puppetd to only use the cache and not to talk to the server at all.
That way we can schedule our laptop clients to still run puppet regularly to enforce security policies, but reduce load on our servers by only downloading a new catalog once or twice a day.
This looks pretty simple to add, but I’m unsure as to the best name for this option.
#2 Updated by Luke Kanies over 4 years ago
I totally like this idea, and have been wanting to do it for a long time.
I’ve even got an idea for how to make it work with files, although it’s a bit messy to explain.
Basically, you have file sources expand at compile time, so that that catalog, as cached on disk, contains everything you need to know about a remote file other than its content — instead it has an md5 sum.
Then your client’s filebucket caches all files that it cares about locally. That is, the catalog is searched for files, and any that specify source as a checksum (or something; this is going to require a change in specification, I think) will be downloaded when the catalog is retrieved.
That way, if any files need to get replaced (because they’ve been modified locally) they can get replaced from the local file bucket (which just operates like a file cache in this case), rather than having to hit the server.
This has the added benefit, even when not offline, of guaranteeing that your file contents only ever change in sync with your catalog – as it is now, you have a kind of race condition and could use a cached catalog but get new file contents.
You’d also need a report queue — something you can slap the reports in to get sent out when the client goes online.
This offline functionality would probably be a bit useful without the local file serving or report queueing, but it would always be limited and throw a bunch of errors.
#3 Updated by Sidney BahmÃ¼ller about 4 years ago
Wouldn’t be an option in the puppet.conf nice, like: cached_catalog = [true | false] cached_interval = [value]
And this could be used like this: cached_interval = 2 => puppet uses the cached catalog 2 times between each run-interval.
For example: runinterval = 1800 cached_interval = 2 => Puppet gets his catalog at 0800 a.m. from server => Puppet runs the catalog at 0810 a.m. from client => Puppet runs the catalog at 0820 a.m. from client => Puppet gets his new catalog at 0830 a.m. from server …
What do you think about that?
#6 Updated by Mukul Malhotra over 1 year ago
I am following the similar way by modifying client puppet.conf with cached_catalog = true but receiving the following error message in offline mode as,
err: Could not retrieve catalog from remote server: getaddrinfo: Name or service not known err: Could not retrieve catalog; skipping run err: Could not send report: getaddrinfo: Name or service not known
Also how & where to define —no-server so that it will not get to the server while offline & cache the config locally.
Any help/advice will be appreciated. Thanks