Automation with chef-solo!

by Till Klampäckel

hello :)

shell% whoami
till
automation
problems
automation
goals
automation
use cases
tools
likes & dislikes
chef-solo
simple setup in 3 steps
recipe in a nutshell
foo/recipes/default.rb
foo/metadata.rb
PHP example
default.rb
Chef::Log.debug("Running php recipe)

package "php5-cgi"
package "php5-cli"
package "php5-mysql"
package "php5-curl"
package "php5-dev"

include_recipe "php::pear"
PHP example
pear.rb
Chef::Log.debug("Running pear recipe")

package "php-pear"

execute "Update PEAR and all packages" do
  command "pear upgrade-all"
end

execute "Install HTTP_Session2 & Net_CheckIP2" do
  command "pear install HTTP_Session2-beta Net_CheckIP-1.0.0RC3"
  not_if "test -f /usr/share/php/pear/HTTP/Session2.php"
end
PHP example
metadata.rb
maintainer        "Till Klampaeckel"
maintainer_email  "till@php.net"
license           "BSD License"
description       "Install PHP & required dependencies."
version           "0.1"
recipe            "php::default", "Install and configure PHP"
recipe            "php::pear", "Install PEAR and packages"

supports 'ubuntu'
PHP example
structure
/tmp/chef/cookbooks/php/
/tmp/chef/cookbooks/php/metadata.rb
/tmp/chef/cookbooks/php/recipes/default.rb
/tmp/chef/cookbooks/php/recipes/pear.rb
PHP example
solo.rb
file_cache_path "/tmp/chef"
cookbook_path "/tmp/chef/cookbooks"
PHP example
node.json
{
  "run_list": [ "recipe[php]" ]
}
Stay flexible!
example
run it
a little more
files
a little more
templates
a little more
attributes

What else?

FIN

Thanks.