Getting Started with Chef – Part 1

In part one we’re going to write a chef cookbook (that does nothing) and get it tested in a local virtual environment.

Install a ruby 

$ rvm install 2.4; rvm use 2.4

Install berkshelf temporarily 

$ gem install berkshelf

Create our cookbook 

$ berks cookbook fts-nginx
$ cd fts-nginx

Edit Gemfile generated by berkshelf command

source 'https://rubygems.org'

gem 'test-kitchen'
gem 'bundler'
gem 'berkshelf'
gem 'kitchen-vagrant'
$ gem install bundler
$ bundle install

Add test-kitchen boilerplate

$ kitchen init
$ kitchen test ubuntu

In the next installment we’ll make our cookbook actually do something useful along with unit and integration testing.

Leave a Reply