Lines of Code
Puppet Chef
http://www.ohloh.net/p/compare?project_0=puppet&project_1=opscode-chef
gem install chef
Opscode
“Chef is a state based,
declarative configuration
management engine.You
define recipes of how you
want your system to look
and then chef makes it so.”
— Ezra Zygmuntowicz
node[:gems].each do |name, gem|
gem_package name do
version gem[:version] if gem[:version]
source gem[:source] if gem[:source]
action :install
end
end
node[:gems].each do |name, gem|
gem_package name do
version gem[:version] if gem[:version]
source gem[:source] if gem[:source]
action :install
end
end
Resources
Α
Β Γ
cron
execute
directory
file
group
user
link
package
remote_directory
remote_file
route
script
service
template
http_request
Providers
node[:gems].each do |name, gem|
gem_package name do
version gem[:version] if gem[:version]
source gem[:source] if gem[:source]
action :install
end
end
directory \"/tmp/something\" do
owner \"root\"
group \"root\"
mode 0755
action :create
end
file \"/tmp/something\" do
owner \"root\"
group \"root\"
mode 0755
action :touch
end
cron \"noop\" do
hour \"5\"
command \"/bin/true\"
end
execute \"slapadd\" do
command \"slapadd < /tmp/something.ldif\"
creates \"/var/lib/slapd/uid.bdb\"
action :run
end
group \"admin\" do
gid 999
end
user \"random\" do
comment \"Random User\"
uid \"1000\"
gid \"users\"
home \"/home/random\"
shell \"/bin/zsh\"
password \"$1$JJsvHslV$szsCjVEroftprNn4JHtDi.\"
end
link \"/tmp/passwd\" do
to \"/etc/passwd\"
link_type :symbolic
end
package \"tar\" do
version \"1.16.1-1\"
action :install
end
# file from cookbook
remote_file \"/tmp/test\" do
source \"test\"
mode 0644
end
# file from remote source
remote_file \"/tmp/testfile\" do
source \"http://example.com/files/test\"
mode 0644
end
remote_directory \"/tmp/remote_something\" do
source \"something\"
files_backup 10
files_owner \"root\"
files_group \"root\"
files_mode 0644
owner \"nobody\"
group \"nobody\"
mode 0755
end
route \"20.0.0.0\" do
gateway \"10.0.0.20\"
metric 5
route_type :net
netmask \"255.255.0.0\"
end
script \"install_something\" do
interpreter \"bash\"
user \"root\"
cwd \"/tmp\"
code <<-EOH
wget http://example.com/tarball.tar.gz
tar -zxf tarball.tar.gz
cd tarball
./configure
make
make install
EOH
end
service \"example_service\" do
case node[:platform]
when \"CentOS\", \"RedHat\", \"Fedora\"
service_name \"redhat_name\"
else
service_name \"other_name\"
end
supports :restart => true
action [ :enable, :start ]
end
template \"/etc/config.conf\" do
source \"config.conf.erb\"
variables({
:timeout => 360
})
end
http_request \"posting data\" do
url \"http://example.com/check_in\"
message :some => \"data\"
end
If you’re tired of running the same commands over more
If you’re tired of running the same commands over and over when setting up your servers, you’ll love Chef. It’s a systems integration framework that allows you to use a Ruby DSL to manage your system configurations, and then easily deploy them across your entire infrastructure, à la Capistrano. Tyler will be breaking down the various components of Chef, and showing some example configurations to get you cooking. less
0 comments
Post a comment