This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prototype mysql_grant provider for Chef | |
| --------------------------------------- | |
| Drop the two files into your mysql cookbook, and experiment with the following examples: | |
| mysql_grant "kenneth" do | |
| action :grant | |
| username "root" # <- User with admin privs | |
| password node[:mysql][:server_root_password] | |
| # Actual grant details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Chef::ShellOut.new("nmap").run_command.stdout.each do |line| | |
| # .. parse line .. | |
| normal[:some_attr] = "whatevs" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby_block "cryptosetup" do | |
| block do | |
| Chef::Mixin::Command.popen4("cryptosetup") do |p, i, o, e| | |
| i.puts "Your stdin" | |
| i.close | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= File.open("/your/file").gets %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service "mysql" do | |
| action :start | |
| ping :node, "role:webserver", { :run_list => "boink" } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r = gem_package "your_library" do | |
| version "1.2.2" | |
| action :nothing | |
| end | |
| r.run_action(:install) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r = gem_package "your_library" do | |
| version "1.2.2" | |
| action :nothing | |
| end | |
| r.run_action(:install) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'chef' | |
| require 'chef/data_bag' | |
| require 'chef/data_bag_item' | |
| bag = Chef::DataBag.load("yourbag") | |
| # The "true" here just inflates them to the data bag items | |
| bag.list(true).each do |item| | |
| item["poop"] = "smith" | |
| item.save | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Will only work for resources that appear *after* this one in the run list | |
| ruby_block "foo" do | |
| block do | |
| r = resources(:service => "bar") | |
| r.action :stop | |
| end | |
| end | |
| # Will actually stop itself | |
| service "bar" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (software "ree" :source "ruby-enterprise-1.8.7-2010.02" | |
| :steps [["bash" "-c" "cd ./source/distro/google-perftools-1.4 && ./configure --prefix=/opt/opscode/embedded --disable-dependency-tracking && make libtcmalloc_minimal.la"] | |
| ["sudo" "mkdir" "-p" "/opt/opscode/embedded/lib"] | |
| ["sudo" "bash" "-c" (str "cp -Rpf " (cond (is-os? "darwin") "./source/distro/google-perftools-1.4/.libs/libtcmalloc_minimal.*" | |
| (is-os? "linux") "./source/distro/google-perftools-1.4/.libs/libtcmalloc_minimal.*") " /opt/opscode/embedded/lib")] | |
| ["bash" "-c" "cd ./source && ./configure --prefix=/opt/opscode/embedded --enable-mbari-api CFLAGS='-g -O2' --with-opt-dir=/opt/opscode/embedded"] | |
| ["bash" "-c" | |
| (cond (is-os? "darwin") "cd ./source && make PRELIBS=\"-Wl,-rpath,/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib -lsystem_allocator -ltcmalloc_minimal\"" | |