Chef infra “如何运行”;刀配置—初始…“配置”;非交互的?

Chef infra “如何运行”;刀配置—初始…“配置”;非交互的?,chef-infra,knife,Chef Infra,Knife,我想运行knife configure--initial命令,而不提示我任何用户输入 到目前为止,我有: knife configure --initial --server-url https://chefserver.example.com --user workstation-user --admin-client-name admin --admin-client-key /home/ec2-user/chef-repo/.chef/admin.pem --validation-clie

我想运行
knife configure--initial
命令,而不提示我任何用户输入

到目前为止,我有:

knife configure --initial --server-url https://chefserver.example.com --user workstation-user --admin-client-name admin --admin-client-key /home/ec2-user/chef-repo/.chef/admin.pem --validation-client-name chef-validator --validation-key /home/ec2-user/chef-repo/.chef/chef-validator.pem --repository /home/ec2-user/chef-repo
然而,它仍然提示我:

WARNING: No knife configuration file found
Where should I put the config file? [/home/ec2-user/.chef/knife.rb]
默认设置是不可接受的-我希望它出现在
/home/ec2 user/chef repo/.chef/knife.rb
中。如果我尝试使用
--config
开关,它会抱怨
knife.rb
文件不存在,因此它显然是在尝试从中读取,而不是写入

它还提示我输入新用户的密码:

Creating initial API user...
Please enter a password for the new user: 
您知道如何将这两个值传递到命令中,以便命令以非交互方式运行到完成吗


谢谢

我不确定这是否能满足您的需要,但是下面的命令可以正常工作

knife cookbook upload helloworld -c /home/ec2-user/chef-repo/.chef/knife.rb

您需要提供此文件“/home/ec2 user/chef repo/.chef/knife.rb”在运行上述命令之前,knife.rb将具有所有chef服务器特定信息。

为什么不将参数化的
knife.rb
写入需要的位置?为什么不将
knife.rb
作为模板写入?该命令除了写入knife.rb文件之外,还可以执行其他操作,就像生成客户端密钥一样,我也需要Craig-你有没有得到一个对你有用的答案?谢谢,马丁。