- Chef 教程
- Chef - 首頁
- Chef - 概述
- Chef - 架構
- Chef - 版本控制系統設定
- Chef - 工作站設定
- Chef - 客戶端設定
- Chef - Test Kitchen 設定
- Chef - Knife 設定
- Chef - Solo 設定
- Chef - Cookbook
- Chef - Cookbook 依賴關係
- Chef - 角色
- Chef - 環境
- Chef - Chef-Client 作為守護程序
- Chef - Chef-Shell
- Chef - 測試 Cookbook
- Chef - Foodcritic
- Chef - ChefSpec
- 使用 Test Kitchen 測試 Cookbook
- Chef - 節點
- Chef - Chef-Client 執行
- 高階 Chef
- 動態配置菜譜
- Chef - 模板
- Chef - Chef DSL 的純 Ruby 程式碼
- Chef - 菜譜中的 Ruby Gems
- Chef - 庫
- Chef - 定義
- Chef - 環境變數
- Chef - 資料包
- Chef - 資料包指令碼
- Chef - 跨平臺 Cookbook
- Chef - 資源
- 輕量級資源提供程式
- Chef - 藍圖
- Chef - 檔案和包
- Chef - 社群 Cookbook
- Chef 有用資源
- Chef - 快速指南
- Chef - 有用資源
- Chef - 討論
Chef - 節點
Knife preflight 顯示了在將 Cookbook 上傳到 Chef 伺服器之前使用特定 Cookbook 的所有節點的詳細資訊。
入門
要開始,我們需要安裝 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。
我們可以執行 preflight 命令來找出哪些節點和角色在其擴充套件執行列表中具有給定的 Cookbook。
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 分配給節點。
您可以將 Cookbook 新增到角色,並將角色新增到節點的執行列表。
您可以將角色新增到另一個角色的執行列表,並將另一個角色新增到節點的執行列表。
Cookbook 可以是另一個已用 Cookbook 的依賴項。
無論 Cookbook 如何最終出現在節點的執行列表中,knife preflight 命令都會捕獲它,因為 Chef 將角色和菜譜的所有擴充套件列表儲存在節點屬性中。knife preflight 命令會精確搜尋這些節點屬性。
廣告