Skip to content

Instantly share code, notes, and snippets.

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
#
# 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
#
@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
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
#!/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"
})
#
# Attribute file/per-node hash
xen_vms = Mash.new
xen_vms[:my_vm] = {
:ip => '10.8.2.204',
:disk => '5Gb',
:memory => '2048Mb'
}
##