Ask Your Question
0

How to use windows environment variable inside puppet script?

asked 2017-10-23 06:57:53 -0600

vaibhav gravatar image

I have set a variable using "setx variable value -m" and now i want to use the value of the variable inside my puppet manifests. I tried: ${variable} %{variable} but none of that worked.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-10-25 04:01:52 -0600

David Schmitt gravatar image

The puppet code is compiled on the server and doesn't have access to environment variables on the target system.

If you want to transport information from the agent to the master, you need to pull it into a custom fact.

If you already know the value you are putting into the environment variable, another (possibly better solution) is to use the source of the information to drive your puppet code.

edit flag offensive delete link more
1

answered 2017-10-23 23:35:00 -0600

Red Cricket gravatar image

You need to make those environment variables in to facts on your node. Read this doc: https://puppet.com/docs/facter/3.9/cu...

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

Stats

Asked: 2017-10-23 06:57:53 -0600

Seen: 65 times

Last updated: Oct 25