diff options
Diffstat (limited to 'chef/examples/config')
23 files changed, 293 insertions, 0 deletions
diff --git a/chef/examples/config/chef-solo.rb b/chef/examples/config/chef-solo.rb new file mode 100644 index 0000000000..2a85253b37 --- /dev/null +++ b/chef/examples/config/chef-solo.rb @@ -0,0 +1,11 @@ +# +# Example Chef Solo Config + +cookbook_path File.join(File.dirname(__FILE__), "cookbooks") +node_path File.join(File.dirname(__FILE__), "nodes") +search_index_path File.join(File.dirname(__FILE__), "..", "search_index") +log_level :info +file_store_path "/tmp/chef" +file_cache_path "/tmp/chef/cache" + +Chef::Log::Formatter.show_time = false diff --git a/chef/examples/config/cookbooks/fakefile/attributes/first.rb b/chef/examples/config/cookbooks/fakefile/attributes/first.rb new file mode 100644 index 0000000000..927dafe967 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/attributes/first.rb @@ -0,0 +1,2 @@ +Chef::Log.debug("You are the first of fakefile's attributes") +friends("you said we wuz visiting em")
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/definitions/test.rb b/chef/examples/config/cookbooks/fakefile/definitions/test.rb new file mode 100644 index 0000000000..ce32293943 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/definitions/test.rb @@ -0,0 +1,13 @@ +define :monkey, :eats => "bananna" do + file "/tmp/monkeynews-#{params[:name]}" do + owner "root" + mode 0644 + action :create + end + + file "/tmp/monkeynews-#{params[:name]}-second-#{params[:eats]}" do + owner "root" + mode 0644 + notifies :touch, resources(:file => "/tmp/monkeynews-#{params[:name]}"), :immediately + end +end
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/turn/the_page.txt b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/turn/the_page.txt new file mode 100644 index 0000000000..9664cb3e15 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/turn/the_page.txt @@ -0,0 +1 @@ +Classic rock is awesome. diff --git a/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/window.txt b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/window.txt new file mode 100644 index 0000000000..68a3bf17e4 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/another/window.txt @@ -0,0 +1 @@ +appleseed?
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/files/default/remote_test/mycat.txt b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/mycat.txt new file mode 100644 index 0000000000..d4d8511934 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/files/default/remote_test/mycat.txt @@ -0,0 +1 @@ +is a very nice kitty
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/files/default/the_park.txt b/chef/examples/config/cookbooks/fakefile/files/default/the_park.txt new file mode 100644 index 0000000000..c71308a6ca --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/files/default/the_park.txt @@ -0,0 +1,3 @@ +Is very pretty on a Saturday at 7:50 in August. Hottest day of the year so far in Seattle. + +something
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/libraries/test.rb b/chef/examples/config/cookbooks/fakefile/libraries/test.rb new file mode 100644 index 0000000000..5a39a18aec --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/libraries/test.rb @@ -0,0 +1,7 @@ +class Chef + class Recipe + def bork + Chef::Log.debug("Bork bork bork") + end + end +end
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/fakefile/recipes/default.rb b/chef/examples/config/cookbooks/fakefile/recipes/default.rb new file mode 100644 index 0000000000..709e51b6e3 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/recipes/default.rb @@ -0,0 +1,152 @@ +bork + +execute "write-foolio" do + command <<-EOH + echo 'monkeypants #{node[:ipaddress]} #{node[:friends]}' > /tmp/foolio + EOH + user "daemon" +end + +script "monkeylikesit" do + code %q{ +print "Woot!\n"; +open(FILE, ">", "/tmp/monkeylikesit") or die "Cannot open monkeylikesit"; +print FILE "You have some interesting hobbies #{node[:ipaddress]}"; +close(FILE); +} + interpreter "perl" +end + +perl "foobar" do + code %q{ +print "Woot!\n"; + } +end + +unless @node[:operatingsystem] == "Darwin" + package "emacs" + + package "emacs" do + action :remove + end + + package "emacs" do + version "22.1-0ubuntu10" + action :install + end + + package "emacs" do + action :upgrade + end + + package "emacs" do + action :purge + end +end + +package "ruby-djbdns" do + action [ :install, :remove, :upgrade, :purge ] + provider Chef::Provider::Package::Rubygems +end + +gem_package "ruby-djbdns" do + action [ :install, :remove, :upgrade, :purge ] +end + +file "/tmp/foo" do + owner "adam" + mode 0644 + action :create + notifies :delete, resources(:file => "/tmp/glen"), :delayed +end + +remote_file "/tmp/the_park.txt" do + owner "adam" + mode 0644 + source "the_park.txt" + action :create +end + +remote_directory "/tmp/remote_test" do + owner "adam" + mode 0755 + source "remote_test" + files_owner "root" + files_group(node[:operatingsystem] == "Debian" ? "root" : "wheel") + files_mode 0644 + files_backup false +end + +template "/tmp/foo-template" do + owner "adam" + mode 0644 + source "monkey.erb" + variables({ + :one => 'two', + :el_che => 'rhymefest', + :white => { + :stripes => "are the best", + :at => "the sleazy rock thing", + } + }) +end + +link "/tmp/foo" do + link_type :symbolic + target_file "/tmp/xmen" +end + +# 0.upto(1000) do |n| +# file "/tmp/somefile#{n}" do +# owner "adam" +# mode 0644 +# action :create +# end +# end + +directory "/tmp/home" do + owner "root" + mode 0755 + action :create +end + +search(:user, "*") do |u| + directory "/tmp/home/#{u['name']}" do + if u['name'] == "nobody" && @node[:operatingsystem] == "Darwin" + owner "root" + else + owner "#{u['name']}" + end + mode 0755 + action :create + end +end + +monkey "snoopy" do + eats "vegetables" +end + +monkey "snack" + +# user "katie" do +# uid 9999 +# gid 100 +# home "/tmp/home/katie" +# shell "/bin/bash" +# comment "Katie Bethell" +# action :create +# end +# +# user "katie" do +# gid 101 +# action :modify +# end +# +# user "katie" do +# shell "/home/katie" +# action :manage +# end +# +# user "katie" do +# action [ :lock, :unlock, :remove ] +# end diff --git a/chef/examples/config/cookbooks/fakefile/templates/default/monkey.erb b/chef/examples/config/cookbooks/fakefile/templates/default/monkey.erb new file mode 100644 index 0000000000..29c2639381 --- /dev/null +++ b/chef/examples/config/cookbooks/fakefile/templates/default/monkey.erb @@ -0,0 +1,5 @@ +This is a <%= @one %> with <%= @el_che %> + +It was rendered on a system with the ipaddress of <%= @node[:ipaddress] %> + +But it's all about the conquest, with <%= @node[:fqdn ] %> diff --git a/chef/examples/config/cookbooks/rubygems_server/attributes/first.rb b/chef/examples/config/cookbooks/rubygems_server/attributes/first.rb new file mode 100644 index 0000000000..d1b7bd6a23 --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/attributes/first.rb @@ -0,0 +1 @@ +rubygems("are awesome") diff --git a/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-scp-1.0.1.gem b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-scp-1.0.1.gem Binary files differnew file mode 100644 index 0000000000..d3eafbca10 --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-scp-1.0.1.gem diff --git a/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-sftp-2.0.1.gem b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-sftp-2.0.1.gem Binary files differnew file mode 100644 index 0000000000..e9bc3c2276 --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-sftp-2.0.1.gem diff --git a/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-2.0.3.gem b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-2.0.3.gem Binary files differnew file mode 100644 index 0000000000..b11cbe00cc --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-2.0.3.gem diff --git a/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-gateway-1.0.0.gem b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-gateway-1.0.0.gem Binary files differnew file mode 100644 index 0000000000..545f850a71 --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/files/default/packages/net-ssh-gateway-1.0.0.gem diff --git a/chef/examples/config/cookbooks/rubygems_server/recipes/default.rb b/chef/examples/config/cookbooks/rubygems_server/recipes/default.rb new file mode 100644 index 0000000000..6b60456094 --- /dev/null +++ b/chef/examples/config/cookbooks/rubygems_server/recipes/default.rb @@ -0,0 +1,8 @@ +remote_directory "/srv/gems" do + owner "www-data" + mode 0755 + source "packages" + files_owner "www-data" + files_group "www-data" + files_mode 0644 +end diff --git a/chef/examples/config/cookbooks/servicetest/recipes/default.rb b/chef/examples/config/cookbooks/servicetest/recipes/default.rb new file mode 100644 index 0000000000..812b48e19d --- /dev/null +++ b/chef/examples/config/cookbooks/servicetest/recipes/default.rb @@ -0,0 +1,12 @@ +service "puppet-client" do + service_name "puppet" + pattern "puppetd" + action :enable +end + +file "/tmp/foo" do + owner "aj" + mode 0644 + action :create + notifies :start, resources(:service => "puppet-client"), :immediate +end diff --git a/chef/examples/config/cookbooks/tempfile/attributes/second.rb b/chef/examples/config/cookbooks/tempfile/attributes/second.rb new file mode 100644 index 0000000000..df791b8429 --- /dev/null +++ b/chef/examples/config/cookbooks/tempfile/attributes/second.rb @@ -0,0 +1 @@ +monkey "poots"
\ No newline at end of file diff --git a/chef/examples/config/cookbooks/tempfile/recipes/default.rb b/chef/examples/config/cookbooks/tempfile/recipes/default.rb new file mode 100644 index 0000000000..b4fa86ac32 --- /dev/null +++ b/chef/examples/config/cookbooks/tempfile/recipes/default.rb @@ -0,0 +1,24 @@ +file "/tmp/glen" do + owner "adam" + mode 0755 + action "create" +end + +file "/tmp/metallica" do + action [ :create, :touch, :delete ] +end + +directory "/tmp/marginal" do + owner "adam" + mode 0755 + action :create +end + +remote_directory "/tmp/rubygems" do + owner "adam" + mode 0755 + source "packages" + files_owner "adam" + files_group "adam" + files_mode 0755 +end diff --git a/chef/examples/config/nodes/adam.rb b/chef/examples/config/nodes/adam.rb new file mode 100644 index 0000000000..c3e8e4bc16 --- /dev/null +++ b/chef/examples/config/nodes/adam.rb @@ -0,0 +1,14 @@ +## +# Nodes should have a unique name +## +name "adam" + +## +# Nodes can set arbitrary arguments +## +owner "Adam Jacob" + +## +# Nodes should have recipes +## +recipes "tempfile", "fakefile" diff --git a/chef/examples/config/nodes/default.rb b/chef/examples/config/nodes/default.rb new file mode 100644 index 0000000000..d365690c60 --- /dev/null +++ b/chef/examples/config/nodes/default.rb @@ -0,0 +1,9 @@ +## +# Nodes can set arbitrary arguments +## +owner "Adam Jacob" + +## +# Nodes should have recipes +## +recipes "tempfile", "fakefile" diff --git a/chef/examples/config/nodes/junglist.gen.nz.rb b/chef/examples/config/nodes/junglist.gen.nz.rb new file mode 100644 index 0000000000..70ce7661b5 --- /dev/null +++ b/chef/examples/config/nodes/junglist.gen.nz.rb @@ -0,0 +1,14 @@ +## +# Nodes should have a unique name +## +name "junglist.gen.nz" + +## +# Nodes can set arbitrary arguments +## +owner "AJ Christensen" + +## +# Nodes should have recipes +## +recipes "servicetest" diff --git a/chef/examples/config/nodes/latte.rb b/chef/examples/config/nodes/latte.rb new file mode 100644 index 0000000000..8987738151 --- /dev/null +++ b/chef/examples/config/nodes/latte.rb @@ -0,0 +1,14 @@ +## +# Nodes should have a unique name +## +name "latte.local" + +## +# Nodes can set arbitrary arguments +## +owner "Adam Jacob" + +## +# Nodes should have recipes +## +recipes "tempfile", "fakefile" |