Provisioners Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.roles_path = "roles" chef.add_role("vm") end end Chef Solo: Tuesday, 19 March 13
Provisioners Vagrant::Config.run do |config| config.vm.provision :chef_server do |chef| chef.chef_server_url = "http://chef.inter.net" chef.add_role("vm") end end Chef Server: Tuesday, 19 March 13
Very brief overview Cookbooks Collections of recipes, templates and other configuration attributes to get stuff done. Recipes Chunks of Ruby code that describe what stuff we need to do to get that stuff done. Tuesday, 19 March 13
Very brief overview Node A virtual machine, cloud server or server Resource Creates a user, expands a template, installs a package etc Tuesday, 19 March 13
Very brief overview Attribute Port number, database name, file location etc Template A template which you create a file from inserting variables Tuesday, 19 March 13
package "ntp" do action :install end template "/etc/ntp.conf" do source "ntp.conf.erb" owner "root" group "root" mode 0644 notifies :restart, resources(:service => "ntp") end service "ntp" do action :start end Install package Create config file from template Define service and start NTP Restart service when config file changes Tuesday, 19 March 13
remote_file node['ch-wordpress']['dir'] + "/wordpress.salt.php" do source "https://api.wordpress.org/secret-key/1.1/salt/" action :create_if_missing mode "0644" end salt_data = '' ruby_block "fetch-wordpress-salt" do block do salt_data = 'node['ch-wordpress']['dir'] + '/wordpress.salt.php') end action :create end Ruby Code in Recipe! Tuesday, 19 March 13
• Community cookbooks http://community.opscode.com/ • IRC #chef on freenode • Foodfight show podcast http://foodfightshow.org/index.html • Ask me [email protected] • Read my book! You’re not alone Tuesday, 19 March 13