有没有一种方法可以使用“刀搜索节点”来进行搜索?或“刀子显示节点”会告诉您所使用的食谱/食谱版本? [英] Is there a way to use "knife search node" or "knife show node" that will tell you the cookbook/recipe version being used?

查看:40
本文介绍了有没有一种方法可以使用“刀搜索节点”来进行搜索?或“刀子显示节点”会告诉您所使用的食谱/食谱版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刀节点显示my_chef_node 将为您提供诸如食谱,角色等信息,但是理想情况下,我想要的是能够看到这些食谱的版本好。

knife node show my_chef_node will give you information like the recipes, roles, etc. but ideally what I want is to be able to see the version of those cookbook recipes as well.

刀搜索节点'recipes:my_cookbook\:\:default'返回节点,但刀搜索节点'recipes:my_cookbook\:\:default@0.3.1'没有。

knife search node 'recipes:my_cookbook\:\:default' returns nodes but knife search node 'recipes:my_cookbook\:\:default@0.3.1' does not.

推荐答案

除非您限制运行列表,否则它将在运行时进行计算。仅通过查看加载到服务器中的食谱版本来确定这一点非常困难。

Unless you constrain the runlist it will be calculated at runtime. Determining this just by looking at the cookbook versions loaded into the server is very hard.

一个人如何约束运行列表?一种机制是在运行列表上显式设置版本,但这只会部分帮助,因为它不会锁定依赖项的版本(除非您已在食谱元数据中添加了约束)。

How does one constrain the runlist? One mechanism is to set the version explicitly on the run-list, but this will only partially help as it won't lock the versions of dependencies (unless you've added constraints in your cookbook metadata).

最好的方法是设置Chef环境并将其与您的受管节点相关联。加载食谱时,使用工具设置食谱约束。例如,使用Berkshelf

The best approach is to setup Chef environments and associate this with your managed nodes. Use tools to set the cookbook constraints when loading cookbooks. For example using Berkshelf

berks upload
berks apply my-special-runtime-env

另一种出租人已知的方法是使用刀谱上传命令

Another lessor known approach is using the knife cookbook upload command

knife cookbook upload --all --force --environment my-special-runtime-env

最后,可以选择使用新的Chef策略文件功能。我并没有亲自使用它,但出于完整性考虑而包含了它。

Finally there the option of using the new chef policy file functionality. I have not personally used it, but include it for completeness.

这篇关于有没有一种方法可以使用“刀搜索节点”来进行搜索?或“刀子显示节点”会告诉您所使用的食谱/食谱版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆