Ask Your Question

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

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

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

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

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


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 -0600 )edit
AmberW gravatar imageAmberW ( 2017-03-16 12:01:30 -0600 )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


Asked: 2014-04-08 04:35:28 -0600

Seen: 9,032 times

Last updated: Apr 08 '14