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/ruby | |
instances = `ec2-describe-instances --show-empty-fields` | |
lines = instances.split(/\n/) | |
running_instances = [] | |
lines.each do |lines| | |
if lines =~ /^INSTANCE/ | |
fields = lines.split(/\t/) | |
if fields[5] == 'running' | |
running_instances << fields[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
# file in your cookbook's library dir | |
module Crazy | |
def go_nuts | |
end | |
end | |
class Chef::Resource | |
include Crazy | |
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
require 'ohai' | |
require 'json' | |
CLIENT_CONFIG_JSON = "/etc/chef/client-config.json" | |
o = Ohai::System.new | |
o.all_plugins | |
begin |
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
# Check this out, rvm use rbx | |
ruby_block "rvm use rbx" do | |
block do | |
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e| | |
o.each_line do |line| | |
env_bits = line.split("=") | |
ENV[env_bits[0]] = env_bits[1] | |
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
# | |
# Tasks to keep your repository in sync with your Chef Server | |
# | |
# Author:: Matthew Kent (<[email protected]>) | |
# Copyright:: Copyright (c) 2010 Matthew Kent | |
# License:: Apache License, Version 2.0 | |
# | |
# 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 |
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
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact |
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 | |
# | |
require 'rubygems' | |
require 'hmac-sha1' # on OS X: sudo gem install ruby-hmac | |
require 'net/https' | |
require 'base64' | |
# | |
# CHANGE ME: S3 access credentials go here, along with CloudFront Distribution ID | |
# |
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/ruby | |
# lists hosts whose chef-client hasn't checked in with the server for a while | |
# how many seconds before we alert | |
threshold = 3600 | |
# requires that your user account is set up for Chef's "knife" utility | |
me = ENV["USER"] |
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
log_level :debug | |
log_location STDOUT | |
validation_client_name 'channels-staging-validator' | |
validation_key './.chef/channels-staging-validator.pem' | |
chef_server_url 'https://api.opscode.com/organizations/channels-staging' | |
cache_options( :path => './.chef/channels-staging-checksums' ) |
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' | |
require 'chef/node' | |
class Opscode | |
class Backup | |
attr_accessor :backup_dir | |
def initialize(backup_dir, config_file) | |
@backup_dir = backup_dir | |
Chef::Config.from_file(config_file) |
OlderNewer