Skip to content

Instantly share code, notes, and snippets.

@akash-b
Forked from arttuladhar/Kitchen-CheetSheet.md
Created September 18, 2016 04:02
Show Gist options
  • Save akash-b/e4c69114cf3a786810c956e5260dc4db to your computer and use it in GitHub Desktop.
Save akash-b/e4c69114cf3a786810c956e5260dc4db to your computer and use it in GitHub Desktop.
Chef and Knife Commands CheatSheet

*** Knife Commands ***

Getting Knife Version

knife --version

Create Cookbook

knife cookbook create <cookbookName>

Getting List of all the client nodes

knife client list

Server Bootstrap

knife bootstrap <hostname/ipaddr> -x <username> -P <password> -N <nodeName>

Server Bootstrap with Runlist

knife bootsrap <hostname> -x root -P <password> -N module3 -r "receipe[apache]"

Server Bootstrap with Sudo with providing user pem file as ssh identity with , and and additional <json_attribute> passing to the node

knife bootstrap <hostname> --sudo -x <user> -i <SSH Itentityfile> --node-name <nodename> --run-list <runlist> -E <Environment> --no-host-key-verify -j <json_attribute>

Add Receipe to RunList for Node

knife node run_list add module2 "receipe[apache]"

Ohai Command

ohai

Knife Node Show

knife node show <nodename>
know node show <nodename> -a <keyName>
knife node show module2 -a apache
knife node show module2

Knife Remove Item from run_list

knife node run_list remove module2 "receipe[apache]"

========

*** Kitchen Commands ***

kitchen list
kitchen create
kitchen login <InstanceName>

####Knife Configure Knife Configure command is used to create knife.rb and client.rb so that they can distribute to workstation and nodes.

Configure client.rb

knife configure client <directory>

Configure knife.rb

knife configure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment