- Chef Tutorial
- Chef - Home
- Chef - Overview
- Chef - Architecture
- Chef - Version Control System Setup
- Chef - Workstation Setup
- Chef - Client Setup
- Chef - Test Kitchen Setup
- Chef - Knife Setup
- Chef - Solo Setup
- Chef - Cookbooks
- Chef - Cookbook Dependencies
- Chef - Roles
- Chef - Environment
- Chef - Chef-Client as Daemon
- Chef - Chef-Shell
- Chef - Testing Cookbooks
- Chef - Foodcritic
- Chef - ChefSpec
- Testing Cookbook with Test Kitchen
- Chef - Nodes
- Chef - Chef-Client Run
- Advanced Chef
- Dynamically Configuring Recipes
- Chef - Templates
- Chef - Plain Ruby with Chef DSL
- Chef - Ruby Gems with Recipes
- Chef - Libraries
- Chef - Definition
- Chef - Environment Variable
- Chef - Data Bags
- Chef - Scripts for Data Bags
- Chef - Cross-Platform Cookbooks
- Chef - Resources
- Lightweight Resource Provider
- Chef - Blueprints
- Chef - Files & Packages
- Chef - Community Cookbooks
- Chef Useful Resources
- Chef - Quick Guide
- Chef - Useful Resources
- Chef - Discussion
Chef - Nodes
Knife preflight shows details about all the nodes which uses a certain cookbook before uploading it to Chef server.
Getting Started
In order to get started, we need to have knife-preflight gem installed.
Step 1 − Define the path in the gem file.
vipin@laptop:~/chef-repo $ subl Gemfile source 'https://rubygems.org' gem 'knife-preflight'
Step 2 − Run bundler to install knife-preflight gem.
vipin@laptop:~/chef-repo $ bundle install Fetching gem metadata from https://rubygems.org/ ...TRUNCATED OUTPUT... Installing knife-preflight (0.1.6)
Working Method
Run knife-preflight on the given cookbook.
We can run the preflight command to find out which nodes and roles have the given cookbook in their expanded run lists.
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
There are multiple ways for a cookbook to get executed on the node.
You can assign the cookbook directly to a node by adding it to the node's run list.
You can add a cookbook to the role and add the role to the node's run list.
You can add the role to the run list of another role and add that other role to the node's run list.
A cookbook can be a dependency of another used cookbook.
No matter how a cookbook ends up in a node's run list, the knife preflight command will catch it as Chef stores all expanded lists of roles and recipes in node attributes. The knife preflight command issues a search for exactly those node attributes.
To Continue Learning Please Login
Login with Google