Chef教程
Chef高级

Chef 节点

Knife preflight 显示使用特定说明书的所有节点的详细信息,然后将其上传到 Chef 服务器。

入门

为了开始,我们需要安装knife-preflight gem。
步骤 1-定义 gem 文件中的路径。
vipin@laptop:~/chef-repo $ subl Gemfile 
source 'https://rubygems.org' 
gem 'knife-preflight' 
第 2 步-运行 bundler 以安装 Knife-preflight gem。
vipin@laptop:~/chef-repo $ bundle install 
Fetching gem metadata from https://rubygems.org/ 
...TRUNCATED OUTPUT... 
Installing knife-preflight (0.1.6)

工作方法

在给定的Cookbook上运行knife 预检。
我们可以运行 preflight 命令来找出哪些节点和角色在其扩展的运行列表中具有给定的说明书。
vipin@laptop:~/chef-repo $ knife preflight ntp 
Searching for nodes containing ntp OR ntp::default in their 
expanded run_list... 
2 Nodes found 
www-staging.example.com 
cms-staging.example.com 
Searching for roles containing ntp OR ntp::default in their 
expanded run_list... 
3 Roles found 
your_cms_role 
your_www_role 
your_app_role 
Found 6 nodes and 3 roles using the specified search 
criteria 
有多种方式可以在节点上执行说明书。
您可以通过将说明书添加到节点的运行列表中,将其直接分配给节点。 您可以向角色添加说明书,并将角色添加到节点的运行列表中。 您可以将角色添加到另一个角色的运行列表中,并将该其他角色添加到节点的运行列表中。 一本Cookbook可以是另一本使用过的Cookbook的依赖。
无论说明书如何在节点的运行列表中结束,当 Chef 将所有扩展的角色和配方列表存储在节点属性中时,knife preflight 命令都会捕获它。 Knife preflight 命令会准确地搜索这些节点属性。
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4