Chef Infra Automation Commands

Chef Infra Automation Commands
Quick Command Guide reference:

 

knife bootstrap IPADDRESS(hostname) –sudo -x username -P password -N target1 (This installs chef-client and validates)

knife bootstrap WIN-I2R3V7Q9AFV –sudo -x username -P passwd -N nodename

 

Bootstrap Virtual box

**********************

knife bootstrap 192.168.1.101 –ssh-user vasanth –ssh-password ‘vasanth123’ –sudo –use-sudo-password –node-name virtuenode

knife bootstrap x.x.x.x –ssh-user ubuntu –sudo –identity-file ./.chef/mykey.pem –run-list webserver

knife bootstrap 172.31.51.157 –ssh-user ec2-user –sudo –identity-file ./.chef/user.pem

knife bootstrap 172.31.51.157 –ssh-user ec2-user –sudo –identity-file “C:Usersuser.sshid_rsa”

 

knife bootstrap windows winrm ADDRESS –winrm-user USER –winrm-password ‘PASSWORD’ –node-name target3 –run-list ‘recipe[learn_chef_iis]’ –winrm-transport ssl –winrm-ssl-verify-mode verify_none

knife bootstrap windows winrm WIN-I2R3V7Q9AFV –winrm-user username –winrm-password ‘passwd’ –node-name target3 –run-list ‘recipe[learn_chef_iis]’ –winrm-transport ssl –winrm-ssl-verify-mode verify_none

knife cookbook create apache

knife cookbook upload apache

Login via putty and run “sudo chef-client”

knife node show target1

knife node show target1 -l

knife node show target1 -Fj

knife node show target1 -a fqdn

knife search node “*:*” -a fqdn

 

From workstation

*******************

Using Chefdk

chef generate repo chef-repo

chef generate cookbook webserver

 

Installing and configuring kitchen

**********************************

Under your Chef local repo

gem install test-kitchen

gem install test-kitchen

kitchen init –create-gemfile /          kitchen init –driver=kitchen-vagrant

kitchen –version

kitchen list

kitchen create default-ubuntu-1404

kitchen list

kitchen converge default-ubuntu-1404

kitchen login default-ubuntu-1404

kitchen verify default-ubuntu-1404

kitchen verify 64 (centos)

kitchen test default-ubuntu-1404

kitchen help

kitchen help init

kitchen destroy

gem install test-kitchen

kitchen init –create-gemfile /          kitchen init –driver=kitchen-vagrant

kitchen –version

kitchen list

kitchen create default-ubuntu-1404

kitchen list

kitchen converge default-ubuntu-1404

kitchen login default-ubuntu-1404

kitchen verify default-ubuntu-1404

kitchen verify 64 (centos)

kitchen test default-ubuntu-1404

kitchen help

kitchen help init

kitchen destroy

Data bag

*********

knife data bag create databagname 1.x.x

Browsing the supermarket

*************************

knife cookbook site list

knife cookbook site search mysql

knife cookbook site show mysql

knife cookbook site show mysql 0.10.0

knife cookbook site download mysql

knife cookbook site install mysql

knife -v

Uploading cookbooks to Supermarket

*****************************************

knife cookbook site share “my_apache2_cookbook” “Web Servers”

Delete Node from Chef server

*****************************

knife node delete my_node (delete node in server)

knife node client my_node (delete client object in server)

Create Roles and environment

*****************************

subl roles/web_server.rb

knife role from file web_server.rb

knife node edit server

sudo chef-client

knife environment create book

knife environment list

knife node list

knife node list -E book

knife node edit my_server

knife node list -E book

knife environment edit book

 

9 thoughts on “Chef Infra Automation Commands”

  1. I almost never comment, but afteer reading a few off tthe comments hee
    Chef Infra Automatijon Commands – CubenSquare. I actually
    do have some questions for you if it’s okay. Is it onnly
    me or does it sseem like a few of these remarks appear like they are coming
    from brain dead people? 😛 And, if you aare writing aat other online sites, I’d like to keep up
    with anything fresh you have to post. Would you list of
    all of your social pages like your Facebook page, twitter feed, or linkedin profile? http://Gizport.jp/gp/question/1776732/?id=26418773

  2. I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

Leave a Comment

Your email address will not be published. Required fields are marked *