This file contains 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
sysadmin_group = Array.new | |
search(:users, 'groups:sysadmin') do |u| | |
sysadmin_group << u['id'] | |
home_dir = "/home/#{u['id']}" | |
user u['id'] do | |
uid u['uid'] | |
gid u['gid'] |
This file contains 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
#!/usr/bin/env ruby | |
servers = %x[ knife search node "name:*econ*" -i].split | |
servers = servers.slice(3, servers.length) | |
servers.each do |s| | |
run_list_str = %[knife node show #{s} -r -f json] | |
run_list = JSON.parse(s_run_list) | |
if not run_list.include? "role[base]" | |
%x[knife node run_list add #{s} "role[base]"] |
This file contains 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
#usage: knife exec /path/to/this/file "recipe_name" || "role_name" | |
run_list_item = ARGV[2] | |
query = run_list_item.delete(']').sub!('[', ':').sub!('::', '\:\:') | |
puts query | |
search(:node, query) do |n| | |
%x[knife node run_list remove "#{n.name}" "#{run_list_item}"] | |
end |
This file contains 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
default['esx']['version'] = "" | |
default['esx']['tarball'] = "" | |
esx_hw_id = %x[ dmidecode | grep -A4 "BIOS Information" | grep 'Address:' ].split[1] | |
case esx_hw_id | |
when "0xEA550" | |
set['esx']['version'] = "4.0" | |
set['esx']['tarball'] = "VMwareTools-4.0.0-208167.tar.gz" | |
set['esx']['checksum'] = "f6f0d2fce35d2abdecf97a522c0b686f709758d37573a4b5dff7a86a17cc485a" |
This file contains 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
here is the tarball url http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gz | |
[Sun, 04 Dec 2011 22:04:02 +0100] DEBUG: Converging node c6.woofinc.com | |
[Sun, 04 Dec 2011 22:04:02 +0100] DEBUG: Processing java_cpr[jdk] on c6.woofinc.com | |
[Sun, 04 Dec 2011 22:04:02 +0100] INFO: Processing java_cpr[jdk] action install (java::oracle line 45) | |
[Sun, 04 Dec 2011 22:04:02 +0100] INFO: Adding jdk to /usr/java/jdk1.7.0_01 | |
app_root is /usr/java | |
cache location is /var/chef/cache/jdk-7u1-linux-i586.tar.gz | |
checksum is acbfb8912a287facbee02ff138d94457aabab409b2f1d15855714ec9608a6cd4 | |
now we're extracting jdk-7u1-linux-i586.tar.gz to /tmp/d20111204-3082-c4cqgg | |
tar (child): /var/chef/cache/jdk-7u1-linux-i586.tar.gz: Cannot open: No such file or directory |
This file contains 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
app_root is /usr/java | |
cache location is /var/chef/cache/jdk-6u29-linux-x64.bin | |
checksum is a8603fa62045ce2164b26f7c04859cd548ffe0e33bfc979d9fa73df42e3b3365 | |
[Tue, 06 Dec 2011 14:56:22 +0100] INFO: Processing remote_file[/var/chef/cache/jdk-6u29-linux-x64.bin] action create_if_missing (/var/chef/cache/cookbooks/java/providers/cpr.rb line 62) | |
/tmp/d20111206-25523-cjfzxn/jdk1.6.0_29 and /usr/java | |
[Tue, 06 Dec 2011 14:56:29 +0100] ERROR: java_cpr[jdk] (java::oracle line 45) has had an error | |
[Tue, 06 Dec 2011 14:56:29 +0100] ERROR: java_cpr[jdk] (/var/chef/cache/cookbooks/java/recipes/oracle.rb:45:in `from_file') had an error: | |
java_cpr[jdk] (java::oracle line 45) had an error: Errno::ENOENT: No such file or directory - /usr/java/jdk1.6.0_29/jre/bin/ControlPanel | |
/usr/lib/ruby/1.8/fileutils.rb:1277:in `utime' | |
/usr/lib/ruby/1.8/fileutils.rb:1277:in `copy_metadata' |
This file contains 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
irb(main):002:0> FileUtils.mv '/tmp/d20111206-25523-cjfzxn/jdk1.6.0_29/' , '/opt/' | |
Errno::ENOENT: No such file or directory - /opt/jdk1.6.0_29/jre/bin/ControlPanel | |
from /usr/lib/ruby/1.8/fileutils.rb:1277:in `utime' | |
from /usr/lib/ruby/1.8/fileutils.rb:1277:in `copy_metadata' | |
from /usr/lib/ruby/1.8/fileutils.rb:453:in `copy_entry' | |
from /usr/lib/ruby/1.8/fileutils.rb:1331:in `traverse' | |
from /usr/lib/ruby/1.8/fileutils.rb:449:in `copy_entry' | |
from /usr/lib/ruby/1.8/fileutils.rb:508:in `mv' | |
from /usr/lib/ruby/1.8/fileutils.rb:1402:in `fu_each_src_dest' | |
from /usr/lib/ruby/1.8/fileutils.rb:1416:in `fu_each_src_dest0' |
This file contains 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
<% if @chef_config[:encrypted_data_bag_secret] -%> | |
( | |
cat <<'EOP' | |
<%= encrypted_data_bag_secret %> | |
EOP | |
) > /tmp/encrypted_data_bag_secret | |
awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret | |
rm /tmp/encrypted_data_bag_secret | |
<% end -%> |
This file contains 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
#usage: knife exec /path/to/this/file "recipe_name" || "role_name" | |
run_list_item = ARGV[2] | |
search(:node, "*:*") do |n| | |
n.run_list.add(run_list_item) | |
n.save | |
end | |
exit 0 |
This file contains 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
sudo_ers "nagios" do | |
user "nagios" | |
cmds [ "check_init_service", "check_hpasm" ] | |
pattern "app" | |
action :install | |
end |