Chef- Knife Commands



Chef- Knife Commands


Chef is a configuration management technology developed by Opscode to manage infrastructure on physical or virtual machines. It is an open-source developed using Ruby, which helps in managing complex infrastructure on the fly.


Knife is Chef's command-line tool to interact with the Chef server and help the user to manage

  • Nodes
  • Cookbooks and recipes
  • Roles, Environments, and Data Bags
  • Resources within various cloud environments
  • The installation of Chef Infra Client onto nodes
  • Searching of indexed data on the Chef Infra Server




In this article, we will be learning some of the most useful Chef Knief Commands.

Purpose
Commands
To Create cookbook
knife cookbook create apache
To upload cookbook to chef-server
knife cookbook upload apache

To add recipe as runlist to a node
knife node run_list add NODENAME “recipe[NAME]

To get knife help
knife -h

To display the attributes of the node
knife node show NODENAME -a attributes (a-b-c-d)0

To search for Linux node
knife search node “os:linux”

To display the platform for Linux node
knife search node “os:linux” -a platform

To display all the environment
knife environment list -w

To compare between two environments
knife environment compare test1
knife environment compare test2

To delete environment
knife environment delete dev

To Display environment information
knife environment show prod

To Create a new role
knife role create role_name

To list all role
knife role list -w

To Delete the role
knife role delete role_name




SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post