custom variable declaration

asked 2017-02-19 03:15:12 -0600

kranthi gravatar image

Hi Team,

How can we pass a custom variable value from the Puppet server to the client machines and that variable needs to be used in a script and return the results to Puppet Server.

Please advise.



edit retag flag offensive close merge delete


what do you mean 'used in a script and return the results to puppet server' ? As far as getting information from the puppet server, there are several options... for a few basic facts about the server,

DarylW gravatar imageDarylW ( 2017-02-19 09:19:20 -0600 )edit

if you want to 'execute' something on the server to get information, the 'generate' command can give you information, but it would probably be much better/cleaner to have a custom hiera backend, or if using puppet 4.9, using a 'data in modules' approach.

DarylW gravatar imageDarylW ( 2017-02-19 09:20:18 -0600 )edit

Hi Daryl, Thanks for your response. I wanted to generate a pwgen key via Puppet Server to the Puppet client using Custom variable and when a script is called from the client it needs to read the Key and execute it and needs to update the key details to the Puppet Server in the form of facts.

kranthi gravatar imagekranthi ( 2017-02-19 09:45:42 -0600 )edit

Generally, you don't worry about the facts on the puppet server, you only care about facts from the agent. So what you want is a unique pwgen key per host, and then you want to be able to get the actual key that was generated for that server from a fact on the ages?

DarylW gravatar imageDarylW ( 2017-02-19 11:55:27 -0600 )edit