如何查询节点上的菜谱版本? [英] How to query cookbook versions on a node?

查看:75
本文介绍了如何查询节点上的菜谱版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用案例:
DevOps团队在某个时间前启动了一个节点,我的团队想知道一个/几个的版本是什么。在run_list中使用的食谱。
我们的DevOps团队在进行消防工作,因此我们想找到一种自给自足的方法。

Usage case: The DevOps team launched a node sometime ago, and my team would like to know what's the version(s) of one/several cookbook(s) being used in the run_list. Our DevOps team is firefighting so we'd like to find a way to be self-sufficient.

已尝试使用的命令:
刀菜谱显示COOKBOOK 给出所有可能的版本,但未指定使用哪个版本。

Commands Tried: knife cookbook show COOKBOOK give all possible versions, but does not specify which one being used.

刀节点显示NODE 显示所有食谱,但没有附加版本信息。

knife node show NODE shows all cookbooks, but there's no version info attached.

问题: 是否存在命令(类似于刀搜索 ohai )来查询厨师服务器以获取节点上部署的版本?

Question: Is there a command (something similar to knife search, ohai) to query the chef-server for the versions deployed on the node?

推荐答案

如果您可以通过ssh进入框中,可以在 / var / chef / cache / cookbooks下查看/<食谱名称> /metadata.json 来查找版本。

If you can ssh into the box you can look under /var/chef/cache/cookbooks/<cookbook name>/metadata.json to find the version.

此外,您可以在厨师运行期间通过查看
@ run_context.cookbook_collection 来访问它,

Also, you can access it during a chef run by looking at @run_context.cookbook_collection, but that probably doesn't help.

通常,菜谱版本是由环境定义的,但是由于环境会随着时间的推移而变化,因此您不能真正相信它是该节点上一次收敛时使用的相同集合(尤其是已经有一段时间)。

Generally the cookbook version is defined by the environment, but since environments change over time, you can't really trust that to be the same set that was used when this node last converged (especially if it's been a while).

到目前为止,最安全的选择是查看厨师缓存。

By far your safest option will be to look at the chef cache.

这篇关于如何查询节点上的菜谱版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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