【发布时间】:2017-05-30 15:07:03
【问题描述】:
假设您通过“knife bootstrap”通过 Chef 工作站引导 Ubuntu 节点,使用参数“--bootstrap-version”指定要在节点上安装的 chef-client 版本为“ 12.9.41”。
在引导操作结束时检查 node 上的 chef-client 版本,您将获得 knife 命令中指定的版本:
[root@myhostname greg]# chef-client -v
Chef: 12.9.41
假设现在您要升级节点上的 chef-client 版本。例如,因为您的运行列表中的新食谱需要更新版本才能工作。
如果您再次运行引导命令,最后指定“--bootstrap-version 12.10.24”,则厨师客户端在节点上仍然相同:
[root@myhostname greg]# chef-client -v
Chef: 12.9.41
在刀引导命令 stdout 上,您还可以获得:
34.210.102.44 [sudo] password for greg: -----> Existing Chef installation detected
34.210.102.44 Starting the first Chef Client run...
34.210.102.44 Starting Chef Client, version 12.9.41
即使节点上安装了另一个 chef-client 版本,有没有办法告诉刀“强制”在“--bootstrap-version”上指定的版本?
解决方法
我找到了另一种方法,使用刀引导命令上的“--bootstrap-install-command”参数并指定用于手动删除和安装目标版本的 bash 命令:
--bootstrap-install-command "sudo apt-get remove chef -y && curl -LO https://omnitruck.chef.io/install.sh && sudo bash ./install.sh -v 12.10.24 && rm install.sh"
执行后,node 上的 chef-client 版本为新版本:
[root@myhostname greg]# chef-client -v
Chef: 12.10.24
关于我的测试用例场景的一些细节:
[ChefServer]
ChefServer version: 12.3.1
chef-client version: 12.5.1
berks version: 4.0.1
[Workstation]
SO: Ubuntu 14.04
Workstation Knife version: 12.19.36
[Node]
SO: Ubuntu 14.04
【问题讨论】:
标签: chef-infra knife