Handy chef commands

Short cuts for doing chef automation in my LAB
#chef server install

yum install wget

wget https://packages.chef.io/stable/el/7/chef-server-core-12.6.0-1.el7.x86_64.rpm

rpm -Uvh chef-server-core-12.6.0-1.el7.x86_64.rpm

chef-server-ctl reconfigure
chef-server-ctl user-create admin andy parsons aparsons@purestorage.com password –filename admin
chef-server-ctl user-create andyp andy parsons sanddragon2009@yahoo.com password –filename andyp.pem
chef-server-ctl org-create puretec puretec-storage –association_user admin –filename puretec-validator.pem
chef-server-ctl install chef-manage

chef-server-ctl reconfigure

chef-manage-ctl reconfigure


#chef client install

mkdir /chef

cd chef

wget https://packages.chef.io/stable/el/7/chef-12.11.18-1.el7.x86_64.rpm

rpm -Uvh chef-12.11.18-1.el7.x86_64.rpm

yum install git

git clone https://github.com/opscode/chef-repo.git

mkdir .chef

cd .chef

#bootstrap a node
from chef workstation
knife bootstrap %node$

create a cookbook

#creates a new cookbook on the workstation
knife cookbook create “cookbook”

browse to the recepies folder and edit the default.rb file to add functions to the recepie
here is where actions funcitons files etc are manageed
#uploads the cookbook to the server
knife cookbook upload “cookbook”

#create roles in the /chef/chef-repo/roles directory
file.rb format place standard roles to assign service types.

#upload or update service on chef server
knife role from file “filename.rb”

display list of roles
knife role list
create a vm
knife vsphere vm clone –template ‘centos7_template2’ –random-vmname

Be the first to comment

Leave a Reply