厨师:在节点

时间:2017-05-30 15:07:04

标签: chef knife

假设你通过你的厨师工作站通过"刀引导"来引导Ubuntu节点。使用参数" - bootstrap-version "指定要在节点上安装的chef-client版本。 as" 12.9.41 "。

在引导操作结束时检查节点上的chef-client版本,您将获得在knife命令中指定的那个:

[root@myhostname greg]# chef-client -v
Chef: 12.9.41

假设您现在要升级节点上的chef-client版本。例如,因为运行列表中的新菜谱需要更新的版本才能运行。

如果再次运行bootstrap命令而是指定" - bootstrap-version 12.10.24 "最后,Chef-client在节点上仍然是相同的:

[root@myhostname greg]# chef-client -v
Chef: 12.9.41

在刀具引导程序命令标准输出中,您还可以:

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

有没有办法告诉刀具"强迫" "上指定的版本 - bootstrap-version"即使节点上安装了另一个chef-client版本?

  

替代方法

我找到了另一种方法,使用" - 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"

执行后,节点上的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

1 个答案:

答案 0 :(得分:2)

不是真的,顾名思义bootstrap仅用于初始引导而不是长期维护。有许多烹饪书可以帮助在节点上升级Chef本身,但是您必须检查哪些与这样的旧版本兼容。