1

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?

Tim Brigham
  • 15,545
  • 10
  • 75
  • 115

1 Answers1

1

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.

Felix Frank
  • 3,093
  • 1
  • 16
  • 22