'knife bootstrap'在不同的位置创建client.rb

问题描述 投票:-1回答:3

我正在使用工作站的knife bootstrap来配置使用cookbook的节点。在节点中,默认情况下在client.rb中创建/etc/chef/文件。

如果我手动运行chef-client,我可以使用--config选项从不同位置加载client.rb

当我使用client.rb引导节点时,我想在不同的位置保存knife bootstrap。可能吗?如果有,怎么样?

帮我。

谢谢,

托马斯阿林。

chef config knife
3个回答
0
投票

你需要制作一个自定义引导程序模板,因为这里的路径是硬编码的:https://github.com/chef/chef/blob/master/lib/chef/knife/bootstrap/templates/chef-full.erb#L227


0
投票

实际上我找到了默认模板文件的问题,因为我正在使用Windows机器。

然后我在C:\opscode\chefdk\embedded\lib\ruby\gems\2.4.0\gems\chef-13.8.5-universal-mingw32\lib\chef\knife\bootstrap\templates\chef-full.erb找到了它。我将它复制并粘贴在chef-repo/bootstrap/chef-full.erb中,我只需将chef文件夹/etc/chef/的默认位置更改为/to/my/path

然后我使用下面的命令来引导节点knife bootstrap NODE_IP -r 'recipe[COOKBOOK]' --bootstrap-template .\bootstrap\chef-full.erb

现在工作正常。

感谢你的帮助:-)


0
投票

现在client.rb文件写在不同的位置(路径/到/ dir)。但是chef-client没有使用此位置的配置文件(client.rb)(path / to / dir)。它仍在从旧位置加载配置(/etc/chef/client.rb)

如何配置chef-client从新位置加载配置文件(/path/to/dir/client.rb)?

© www.soinside.com 2019 - 2024. All rights reserved.