Directories: The cache directory (vardir)

This version of Puppet is not included in Puppet Enterprise. The latest version of PE includes Puppet 4.9.

Puppet’s cache directory, sometimes called vardir, contains dynamic and/or growing data that Puppet creates automatically in the course of its normal operations. Some of this data can be mined for interesting analysis, or to integrate other tools with Puppet; other parts are just infrastructure and should be ignored by most or all users.

Location

Puppet agent/apply and Puppet Server use different cache directories.

Puppet Server’s cache directory defaults to:

  • /opt/puppetlabs/server/data/puppetserver

The cache directory for Puppet agent and Puppet apply can be found at one of the following locations:

  • *nix Systems: /var/opt/puppetlabs/puppet/cache
  • Windows: %PROGRAMDATA%\PuppetLabs\puppet\cache (usually C:\ProgramData\PuppetLabs\puppet\cache)
  • non-root users: ~/.puppetlabs/opt/puppet/cache

When Puppet is running as either root, a Windows user with administrator privileges, or the puppet user, it will use a system-wide cache directory. When running as a non-root user, it will use a cache directory in that user’s home directory.

The system cache directory is what you usually want to use, since you will usually run Puppet’s commands and services as root or puppet. (Note that admin commands like puppet cert must be run with sudo to use the same directories as Puppet agent or Puppet master.)

Note: When Puppet master is running as a Rack application, the config.ru file must explicitly set --vardir to the system cache directory. The example config.ru file provided with the Puppet source does this.

Configuration

Puppet’s cache directory can be specified on the command line with the --vardir option, but it can’t be set via puppet.conf. If --vardir isn’t specified when a Puppet application is started, it will always use the default cache directory location.

Puppet Server uses the jruby-puppet.master-var-dir setting in puppetserver.conf to configure its cache directory.

Interpolation of $vardir

Since the value of the vardir is discovered before other settings, you can safely reference it (with the $vardir variable) in the value of any other setting in puppet.conf or on the command line:

[main]
  ssldir = $vardir/ssl

If you need to set nonstandard values for some settings, this allows you to avoid absolute paths and keep your Puppet-related files together.

Contents

The vardir contains several directories. Most of these subdirectories contain a variable amount of automatically generated data; some of them contain notable individual files. Some directories are used only by agent or master processes.

The default layout of the vardir is as follows. Most of the files and directories can have their locations changed with settings in puppet.conf. The link for each item goes to its description in the configuration reference.

↑ Back to top