On Github linc01n / chef-solo-intro
Lincoln Lee
http://chef-solo-intro.lincoln.hk
10 July 2013
Cloud Infrastructure Automation Framework
Infrastructure as code
Write your infrastructure in Ruby
Versioning on infrastructure
Replicate server on different providers (AWS, Linode, VirtualBox)
so on...
Chef use a server/client model
Chef-solo remove the server part
# A chef-demo Gemfile source "https://rubygems.org" gem "knife-solo" gem "librarian-chef"
$ knife solo init .
$ librarian-chef init
It will create a Cheffile.
#!/usr/bin/env ruby #^syntax detection site 'http://community.opscode.com/api/v1' # cookbook 'chef-client' # cookbook 'apache2', '>= 1.0.0' # cookbook 'rvm', # :git => 'https://github.com/fnichol/chef-rvm' # cookbook 'postgresql', # :git => 'https://github.com/findsyou/cookbooks', # :ref => 'postgresql-improvements'
$ knife solo prepare root@192.168.5.164
It will do 2 things:
SSH to the remote server and install chef
Create a json file in nodes dir
#!/usr/bin/env ruby #^syntax detection site 'http://community.opscode.com/api/v1' cookbook "nginx"
Add Nginx to runlist in nodes json
{ "run_list":["recipe[nginx::source]"] }
$ knife solo cook root@192.168.5.164
The code is on github: https://github.com/linc01n/chef-demo