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 node.chef_environment != 'development' | |
cookbooks = {} | |
node.cookbook_collection.values.each {|c| cookbooks[c.name.to_s] = c.version.to_s } | |
# See https://github.com/danryan/spice | |
r = gem_package "spice" do | |
version "0.8.0" | |
end | |
r.run_action(:install) |
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
ssl_verify_mode :verify_peer | |
ssl_ca_file CA_FILE | |
log_level :info | |
log_location STDOUT | |
chef_server_url 'SERVER_URL' | |
validation_client_name 'ORGNAME-validator' | |
node_name 'NODE_NAME' | |
base_dir = "#{ENV['HOME']}/.chef" |
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 | |
# assumes this file is sibling to .chef dir, ex: CHEF_REPO/tasks | |
config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb') | |
Chef::Config.from_file(config) | |
require 'active_support' | |
require 'aws' | |
desc 'Delete any ec2-based chef nodes that no longer exist' |
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
(require 'chef) | |
(resource :file "/tmp/foo" | |
:owner "cb" | |
:action :create) | |
(resource :file (concatenate 'string "/tmp/" (node-attributes :hostname) "-made-with-lisp") | |
:action :create) | |
;; or |
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 ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
if [ ! -f /usr/bin/chef-client ]; then | |
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm | |
rpm -Uvh epel-release-5-4.noarch.rpm | |
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>-O /etc/yum.repos.d/aegisco-testing.repo http://testing.aegisco.com/el5/aegisco-testing.repo | |
yum install -y rubygems rubygem-chef |
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
run_context.resource_collection.each do |r| | |
r.source_line =~ /cookbooks\/(.+?)\/recipes\/(.+)\.rb:.+/ | |
cookbook_name = $1 | |
recipe_part = $2.gsub('/', "::") | |
recipe_name = "#{cookbook_name}::#{recipe_part}" | |
if node[:isolation][:recipes].include?(recipe_name) || node[:isolation][:cookbooks].include?(cookbook_name) | |
Chef::Log.info("Setting #{r.to_s} to ignore failure, via the isolation cookbook") | |
r.ignore_failure(true) | |
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
include_recipe "collectd" | |
class ChefCollectdPluginReportHandler < Chef::Handler | |
def report | |
Chef::Log.info('Running collectd hander') | |
node[:last_success_time] = Time.now.to_f | |
node[:error_count_since_success] = 0 | |
node.save | |
end | |
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
;;; http-twiddle.el -- send & twiddle & resend HTTP requests | |
;; This program belongs to the public domain. | |
;; Author: Luke Gorrie <luke@synap.se> | |
;; Maintainer: Hasan Veldstra <h@vidiowiki.com> | |
;; Created: 1 Feb 2006 | |
;; Adapted-By: Hasan Veldstra | |
;; Adapted-By: Christopher Brown <cb@opscode.com> | |
;; Version: 1.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
{ | |
"chef": { | |
"url": "http://localhost:4000", | |
"webui_enabled": true, | |
"init_style": "init", | |
"path": "/var/lib/chef", | |
"run_path": "/var/run/chef", | |
"cache_path": "/var/cache/chef", | |
"backup_path": "/var/lib/chef/backup" | |
}, |