- Chef - Chef-Client Run
- Chef - Nodes
- Testing Cookbook with Test Kitchen
- Chef - ChefSpec
- Chef - Foodcritic
- Chef - Testing Cookbooks
- Chef - Chef-Shell
- Chef - Chef-Client as Daemon
- Chef - Environment
- Chef - Roles
- Chef - Cookbook Dependencies
- Chef - Cookbooks
- Chef - Solo Setup
- Chef - Knife Setup
- Chef - Test Kitchen Setup
- Chef - Client Setup
- Chef - Workstation Setup
- Chef - Version Control System Setup
- Chef - Architecture
- Chef - Overview
- Chef - Home
Advanced Chef
- Chef - Community Cookbooks
- Chef - Files & Packages
- Chef - Blueprints
- Lightweight Resource Provider
- Chef - Resources
- Chef - Cross-Platform Cookbooks
- Chef - Scripts for Data Bags
- Chef - Data Bags
- Chef - Environment Variable
- Chef - Definition
- Chef - Libraries
- Chef - Ruby Gems with Recipes
- Chef - Plain Ruby with Chef DSL
- Chef - Templates
- Dynamically Configuring Recipes
Chef Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Chef - Nodes
Knife prefpght 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-prefpght gem installed.
Step 1 − Define the path in the gem file.
vipin@laptop:~/chef-repo $ subl Gemfile source https://rubygems.org gem knife-prefpght
Step 2 − Run bundler to install knife-prefpght gem.
vipin@laptop:~/chef-repo $ bundle install Fetching gem metadata from https://rubygems.org/ ...TRUNCATED OUTPUT... Instalpng knife-prefpght (0.1.6)
Working Method
Run knife-prefpght on the given cookbook.
We can run the prefpght command to find out which nodes and roles have the given cookbook in their expanded run psts.
vipin@laptop:~/chef-repo $ knife prefpght ntp Searching for nodes containing ntp OR ntp::default in their expanded run_pst... 2 Nodes found www-staging.example.com cms-staging.example.com Searching for roles containing ntp OR ntp::default in their expanded run_pst... 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 pst.
You can add a cookbook to the role and add the role to the node s run pst.
You can add the role to the run pst of another role and add that other role to the node s run pst.
A cookbook can be a dependency of another used cookbook.
No matter how a cookbook ends up in a node s run pst, the knife prefpght command will catch it as Chef stores all expanded psts of roles and recipes in node attributes. The knife prefpght command issues a search for exactly those node attributes.
Advertisements