Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Chef infra 将配方添加到Chef run_列表和Chef client-o选项_Chef Infra_Chef Recipe - Fatal编程技术网

Chef infra 将配方添加到Chef run_列表和Chef client-o选项

Chef infra 将配方添加到Chef run_列表和Chef client-o选项,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我有node.run_list.add('recipe[ckbk::recipe_name]')在ckbk::recipe中。当使用-o选项运行chef client时,run\u列表中的recipe\u name。add不会添加到runlist中。这是否是使用chef-client-o的预期行为当您使用-o选项运行chef-client时,您只会覆盖该运行的运行列表,因此基本上会将运行列表冻结为新的运行列表,并且您无法更改它 -o RUN_LIST_ITEM, --override-runli

我有
node.run_list.add('recipe[ckbk::recipe_name]')
ckbk::recipe
中。当使用-o选项运行chef client时,
run\u列表中的
recipe\u name
。add
不会添加到runlist中。这是否是使用
chef-client-o

的预期行为当您使用
-o
选项运行chef-client时,您只会覆盖该运行的运行列表,因此基本上会将运行列表冻结为新的运行列表,并且您无法更改它

-o RUN_LIST_ITEM, --override-runlist RUN_LIST_ITEM
Replace the current run list with the specified items. This option will not clear the list of cookbooks (and related files) that is cached on the node.

您可以使用
include_recipe
将多个(其他)食谱包含在主食谱中。它不会更改运行列表,但包含的配方将作为较低级别的依赖项添加到您的运行列表中。

我认为
运行列表。添加
不会影响当前运行。这需要完全重新扩展运行列表和版本解决方案。“正常”这只会影响您的下一次运行,但是
-o
会自动禁用将节点数据保存回服务器,因为您可能会得到部分数据。

我可能会弄错,但我非常确定修改node.run\u列表不会将配方添加到您的运行列表中。它只会将其添加到属性中,但不会导致执行配方。是。这似乎是一种行为,即配方被添加到未执行的属性位。谢谢@rastasheep。由于我需要运行一个配方,作为运行列表中的最后一个配方运行,因此我无法使用
include\u recipe
。因为它是您的食谱,您可以在运行结束时通知您的资源运行。这里有一些例子,再次感谢。因为这是在最后执行一个
配方
,所以想知道有没有类似于
通知
a
资源
的技术。谢谢@coderanger。因此,简而言之,在chef客户端运行期间,运行列表不能动态更改。您可以使用
include_recipe
动态决定运行哪些食谱,但不能在运行期间添加或删除食谱。