Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef Solo get user input

I don't know why I can't find anything on the interwebs about this.

I basically want to write a recipe that prompts a user for their github username/password, then posts to the github API to add an ssh key.

I'm sure I can prompt a user with normal ruby methods (ie gets) but this doesn't seem natural given all the utilities chef provides.

Can someone tell me a 'chef' way of prompting a user for input to store in vars for later use?

I'd like to first output some instructions for the user to read, then get the username, then password, I guess for safety reasons, the password should not be shown on the console as they type

like image 566
brad Avatar asked Dec 01 '25 05:12

brad


1 Answers

I'd say chef is not made for such user input.

You might use ruby code that is executed during the compile phase of the chef run, but I'd suggest the following:

What about reading it from an environment variable?

like image 193
StephenKing Avatar answered Dec 05 '25 21:12

StephenKing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!