Ask Your Question
1

How to pass custom facts by command line argument to puppet apply

asked 2014-04-08 04:35:28 -0500

Adam Ryczkowski gravatar image

I'd like to play with my puppet by simulating different facts. It would be very nice, if I could set custom facts via command line to puppet apply, like puppet apply main.pp --facts workingdir=/home/adam/puppet

Is anything similar possible?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2014-04-08 04:39:40 -0500

Adam Ryczkowski gravatar image

OK, I've found an answer on Stack Exchange

To pass a value through the command line it needs to be an environment variable, prefixed by FACTER_.

So, FACTER_foo will turn into $::foo.

edit flag offensive delete link more

Comments

I've used this before, and it works great. I've also seen some interesting uses of this for bootstrapping... Say you have some custom facts, but the facts won't be correctly populated till after the first puppet run... you can pre-populate them if you know what value they should be using this!

DarylW gravatar imageDarylW ( 2016-03-04 22:58:06 -0500 )edit
AmberW gravatar imageAmberW ( 2017-03-16 12:01:30 -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: 2014-04-08 04:35:28 -0500

Seen: 5,803 times

Last updated: Apr 08 '14