Ask Your Question
0

vardir translation problem

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

stuntman2625 gravatar image

Hello,

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:

"${settings::vardir}/dummy-dir"

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?

Thanks

edit retag flag offensive close merge delete

Comments

is vardir set on the agents puppet config?

negast gravatar imagenegast ( 2017-06-12 03:47:10 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

negast gravatar image

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

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.

[agent]

vardir = /some/dir/name


$facts['puppet_vardir']

edit flag offensive delete link more

Comments

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 -0500 )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

Stats

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

Seen: 23 times

Last updated: Jun 13