Skip to content

Instantly share code, notes, and snippets.

#
# Attribute file/per-node hash
xen_vms = Mash.new
xen_vms[:my_vm] = {
:ip => '10.8.2.204',
:disk => '5Gb',
:memory => '2048Mb'
}
##
#!/usr/bin/ruby
require 'chef'
require 'chef/rest'
Chef::Log.debug("Authenticating via openid")
response = @rest.post_rest('openid/consumer/start', {
"openid_identifier" => "#{Chef::Config[:openid_url]}/openid/server/node/program_auth",
"submit" => "Verify"
})
begin
Timeout.timeout(Chef::Config[:run_command_stdout_timeout]) do
while stdout.ready? == nil
Chef::Log.debug("Waiting for STDOUT to be ready..")
sleep 1
end
end
rescue Timeout::Error => e
Chef::Log.error("#{args[:command]} timed out reading STDOUT")
else
@chef
chef / gist:52664
Created January 26, 2009 02:15 — forked from thommay/gist:52663
if node[:platform_version].to_f < 8.04
remote_file "/etc/event.d/runsvdir" do
only_if do Dir.exists?("/etc/event.d") end
end
end
#
# Cookbook Name:: CHEF-37
# Recipe:: default
#
# Copyright 2009, Example Com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
require 'chef'
require 'chef/node'
require 'chef/rest'
# A registration for your API access
api_user = "monkey"
# A password for the API access
api_pass = "pants"
# A validation token, if you use them
validation_token = nil
%w{merb-core merb-haml syntax}.each do |gem|
gem_package gem
end
# Upgrade
%w{merb-core merb-haml syntax}.each do |gem|
gem_package gem do
action :upgrade
end
end
#!/usr/bin/ruby
require 'rubygems'
require 'chef'
require 'chef/node'
require 'chef/rest'
# A registration for your API access
api_user = "monkey"
# A password for the API access
{
"command": {
"ps": "ps -ef"
},
"kernel": {
"modules": {
"com.parallels.kext.vmmain": {
"size": 65536,
"version": "3.0",
"index": "128",
{
{
"username": "bobo",
"emails": [ "foo@bar.com", "foo@baz.com" ]
}
{
"username": "theclown",
"emails": [ "baa@bar.com", "fooor@baz.com" ]
}
}