Chef Solo获得用户输入 [英] Chef Solo get user input

查看:56
本文介绍了Chef Solo获得用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么我在互联网上找不到关于此的任何东西。

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

我基本上想写一条食谱来提示用户输入他们的github用户名/密码,然后发布到github API以添加ssh密钥。

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.

我确定我可以使用正常的ruby方法提示用户(例如,gets),但这

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.

有人可以告诉我一种主厨的方式来提示用户输入要存储在vars中以便以后使用的方式吗?

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

推荐答案

我会说厨师不是由这种用户输入的。

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

您可以使用在厨师运行的编译阶段执行的ruby代码,但我建议以下内容:

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

环境变量

这篇关于Chef Solo获得用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆