Ask Your Question

Set variable to file content

asked 2017-10-10 11:42:39 -0600

kexpo gravatar image

I am trying to set a variable in puppet to the content of a file located on a server. The file will only contain a string.

After some research, it seems a custom fact is probably the way to do this, but I cannot grasp the concept entirely. I am somewhat clear on how to write it, but I'm not sure where to write/store the fact, if that makes sense. Can anyone help clear up if this is in fact the best way, and if so, give a little better walkthrough than the Puppet docs?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-11 09:41:14 -0600

DarylW gravatar image

This is documented in the puppet docs

When you write a custom fact, you place it in a module that you are loading on your node, in the module's lib/facter/ directory. During modulesync, this will get pulled from the master to the client, the facts will be collected on the client, and then sent back to the master for use during catalog compilation.

For example, in the puppet-staging module, they have a few example custom facts.

edit flag offensive delete link more

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-10-10 11:42:39 -0600

Seen: 969 times

Last updated: Oct 11 '17