3. What’s it for Born out of “cloud computing” and dev-ops Cross platform Configuration and deployment tool written in ruby Execute OS commands Focuses on reusable recipes @colin_gemmell pythonandchips@gmail.com
4. Termanology Resource – Executable bit of code Recipe – Collection of resources Cookbook – recipes and all other files need for to complete a task @colin_gemmell pythonandchips@gmail.com
5. Why Allows configuration of every environment the same Version Control your configurations Not just for servers @colin_gemmell pythonandchips@gmail.com
6. How 2 different flavours of chef Chef Server & Chef Client Chef Solo Bootstrap the environment Configuration file Main recipe Resources @colin_gemmell pythonandchips@gmail.com
7. Package Install application from package manager package "couchdb" do package_name "couchdb" end @colin_gemmell pythonandchips@gmail.com
8. Template Generate file based on an erb template template "/home/cgemmell/.gitconfig" do source "gitconfig.erb" owner node[:user] group node[:user] mode "0644" variables( :name => node["name"], :email => node["email"] ) end @colin_gemmell pythonandchips@gmail.com
10. Creating files and directories directory “/home/cgemmell/projects" do owner node[:user] group node[:user] mode "0755" action :create end file "/home/#{node[:user]}/.bashrc" do group node[:user] owner node[:user] mode "0644" content "source .bashrvm" action :create not_if do File.exists?("/home/cgemmell/.bashrc") end end @colin_gemmell pythonandchips@gmail.com
11. Execute script bash "install coffeescript" do interpreter "bash" user "root" cwd “/home/cgemmell” code “npm install -g coffee-script” end @colin_gemmell pythonandchips@gmail.com
12. Download remote file remote_file “/tmp/RubyMine-3.1.1.tar.gz" do source "http://download.jetbrains.com/ruby/RubyMine-3.1.1.tar.gz" end @colin_gemmell pythonandchips@gmail.com
13. Checkout from Source control git “/home/cgemmell/projects/chef" do user node[:user] group node[:user] repository “git@github.com:opscode/chef” reference "master" action :sync end @colin_gemmell pythonandchips@gmail.com
14. Chef on windows Not fully supported Manual installation a bit complicated Installer available at https://github.com/downloads/pmorton/chef-windows-installer/ChefInstaller.exe More info avaiable at http://wiki.opscode.com/display/chef/Installation+on+Windows @colin_gemmell pythonandchips@gmail.com
15. Powershell Powershell “cwd-then-write” do cwd “temp” code <<-EOH $stream = [System.IO.StreamWriter] “./temp-write-from-chef.txt” $stream.WriteLine(“Chef on windows is awesome”) $stream.close() EOH end N.B. Dependant on the powershell @colin_gemmell pythonandchips@gmail.com
16. The end Resources Documentation http://wiki.opscode.com/display/chef/Home Source code https://github.com/opscode/chef Pre-written recipes https://github.com/opscode/cookbooks VM Setup https://github.com/pythonandchips/chef-vm-setup Twitter: @colin_gemmell E-mail: pythonandchips@gmail.com @colin_gemmell pythonandchips@gmail.com