Is there a good way to set up caching for Puppet, specifically templates? I have a number of modules that would be really, really useful to have available in a DR situation.

Proposed Solution

I know there isn't an inbuilt way to set up caching directly, based on the template documentation. Natively templates are rendered server side and there isn't a direct way to change this.

I was thinking about using a custom mount point to pull down specific modules I flag for offline use. This would be pointed back to the same directory puppet master reads from, to avoid things getting out of sync. I actually already have the basics for this working.

Once I have a local copy some kind of logic could perform a puppet run using the local mirror.

This would be a pseudo masterless puppet, something like

puppet apply --modulepath ./modules manifests/site.pp

How can I have effectively have puppet say puppet master isn't available, so execute these commands?

  • I presume there are reasons you don't want a masterless puppet setup? – Ladadadada Jun 30 '14 at 21:36
  • Do you need the templates to be re-rendered based on dynamic fact values? I ask because the agent does cache templated files out of the box. – Felix Frank Jul 1 '14 at 7:29
  • @FelixFrank that is exactly it. – Tim Brigham Jul 1 '14 at 11:28

As long as the master is operating normally, the agent will update the timestamp on $vardir/state/state.yaml on every run. A failing master (including compiler errors etc.) will lead to an outdated state.yaml file. You can use its freshness to determine whether your master is up and well.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.