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
#!./bin/knife exec | |
# A knife exec script to change chef node's name, preserving all the attributes. | |
# | |
# Usage: knife exec rename-node.rb old-name new-name | |
# | |
# Script retrieves the Node object, changes its 'name' attribute, | |
# creates new Node object with updated name and rest of attributes | |
# untouched. Then it deletes old Node and Client objects from | |
# database, and logs into the server to update it: |
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
namespace :ec2 do | |
# setup chef config | |
# | |
config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb') | |
Chef::Config.from_file(config) | |
load_gem_or_report(%w{aws}) | |
desc 'Delete any ec2-based chef nodes that no longer exist' | |
task :cleanup_nodes do |
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
Veewee::Session.declare( { | |
:cpu_count => '1', :memory_size=> '384', | |
:disk_size => '10140', :disk_format => 'VDI', | |
:os_type_id => 'RedHat', | |
:iso_file => "CentOS-6.0-i386-bin-DVD.iso", :iso_src => "", :iso_md5 => "d7e57d6edaca1556d5bad2fa88602309", :iso_download_timeout => 1000, | |
:boot_wait => "10",:boot_cmd_sequence => ['<Esc>', 'linux text ks=http://%IP%:%PORT%/ks.cfg<Enter>'], | |
:kickstart_port => "7122", :kickstart_timeout => 10000,:kickstart_file => "ks.cfg", | |
:ssh_login_timeout => "100",:ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "", | |
:ssh_host_port => "7222", :ssh_guest_port => "22", | |
:sudo_cmd => "echo '%p'|sudo -S sh '%f'", |
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
z = 3 * 0x41662d2d * 123750872726249 | |
o = [] | |
puts z.to_s(16) | |
while z != 0 | |
# let's eat through z one byte at a time | |
l = z >>4 &0xf #shift right then AND with 16 to get the character | |
r = z &0xf #just AND with 16 to get the XORed with l position in the array | |
o[r^l]=(l + 97).chr #put the character in the correct spot in the array |
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
bash -c ' | |
echo <%= @config[:chef_node_name] %> > /tmp/chef_node_name | |
cat /tmp/chef_node_name | cut -d. -f1 > /tmp/proper_hostname | |
cat /tmp/chef_node_name | cut -d. -f2 | tr -d "\n" > /tmp/proper_dnsdomainname | |
echo -n "." >> /tmp/proper_dnsdomainname | |
cat /tmp/chef_node_name | cut -d. -f3 >> /tmp/proper_dnsdomainname | |
IPV4ADDR=`ip addr | grep eth0 | grep "inet " | cut -d " " -f 6 | cut -d \/ -f 1` |
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 | |
def find_deps(cookbook_dir) | |
nel = Hash.new { |h, k| h[k] = [] } | |
Dir.glob("#{cookbook_dir}/*/").each do |r| | |
deps_for(r, nel) | |
end | |
nel | |
end |
NewerOlder