Ask Your Question

vardir translation problem

asked 2017-06-09 08:27:47 -0600

stuntman2625 gravatar image


Just wondering if it's possible to reference the puppet agent's vardir in a puppet class instead of it defaulting to the master's value? We have a puppet class that creates a directory defined as follows:


However, when we include this class on our agents, it translates vardir to the puppet server's value of /opt/puppetlabs/server/data/puppetserver which obviously doesn't exist on our agents.

The agent's vardir is /opt/puppetlabs/puppet/cache, but I'd prefer not to hardcode that value in the puppet class if there's a way around it.

Any ideas?


edit retag flag offensive close merge delete


is vardir set on the agents puppet config?

negast gravatar imagenegast ( 2017-06-12 03:47:10 -0600 )edit

I've tried setting it on the client side (/etc/puppetlabs/puppet/puppet.conf), and that successfully pulls down all the libraries to whatever directory I set it to. However, it still tries to translate the directory I have defined in my class to the master's vardir. We use that dir for copying files

stuntman2625 gravatar imagestuntman2625 ( 2017-06-12 16:29:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-13 08:17:15 -0600

negast gravatar image

updated 2017-06-13 08:19:34 -0600

K my apologies on my comment i should have checked first but anyways I simulated your problem. And indeed when using: ${::settings::vardir} the vairable would use the master settings. This is expected apparantly because when you call the ::settings facts you're calling on the master server settings. about server facts

so anyways for the solution: you have to use the puppet_vardir fact to get the vardir for your agent.

I also set the vardir in agent section on my node if it does not work.


vardir = /some/dir/name


edit flag offensive delete link more


That did the trick! I didn't realize that fact existed so it was an easy fix at least. Thanks a lot for the help!

stuntman2625 gravatar imagestuntman2625 ( 2017-06-13 14:04:19 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-06-09 08:27:47 -0600

Seen: 31 times

Last updated: Jun 13 '17