emacs setup.rb
setup.rb
# checkout: docs.chef.io/resources.html
type 'name' do
properties # like version
actions # like :install, :create, etc.
end
sudo chef-client --local-mode --runlist 'recipe[chef-workstation]' | |
sudo chef-client --help | |
# /etc/chef/client.rb => manages the execution of the chef client run |
emacs setup.rb
setup.rb
# checkout: docs.chef.io/resources.html
type 'name' do
properties # like version
actions # like :install, :create, etc.
end
### Step 1: Installation | |
brew cask install chefdk # install ChefDK | |
brew cask install virtualbox # install VirtualBox | |
brew cask install vagrant # install vagrant for spinning up a disposable environment for testing | |
brew cask install vagrant-manager | |
# verify installation | |
chef --version | |
vagrant --version | |
vboxmanage --version | |
### Step 2: Testing | |
cd . && mkdir chef && cd chef | |
vagrant box add bento/ubuntu-14.04 # install Ubuntu image | |
vagrant init bento/ubuntu-14.04 # initialize image | |
vagrant up # run image | |
vagrant ssh # ssh into running container | |
# addition vagrant commands | |
vagrant status # check status of the VM | |
vagrant suspend # suspend the VM | |
vagrant destroy # destroy VM (will need to re-provision things from the ground up | |
# and re-run all the installation cmds in order to setup the ChefDK again) | |
### Step 3: Inside Shell, install dependencies | |
sudo apt-get update # update utilities | |
sudo apt-get -y curl # install curl | |
curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable |
# - `Berksfile`: file for managing chef dependencies and can be managed using the `berks` chef utility | |
# - note: might've been changes since the file no longer gets created by chef generator | |
# run ruby inside chef | |
chef exec irb |