Skip to content

Instantly share code, notes, and snippets.

define :github, :user => "root", :home => "/root", :group => "" do
package "git-core"
group = params[:group].empty? ? params[:user] : params[:group]
directory "#{params[:home]}/.ssh" do
mode "0700"
owner params[:user]
group group
description "Noitd Monitoring Scout Server"
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
expect daemon
oom never
require_recipe 'fog'
route53_rr node[:ec2][:instance_id] do
record_type "CNAME"
fqdn "#{node[:ec2][:instance_id]}.#{node["route53"]["domain"]}"
rdata(["#{node[:ec2][:public_hostname]}."])
accesskey node["route53"]["accesskey"]
secretkey node["route53"]["secretkey"]
zoneid node["route53"]["zoneid"]
action :update
@thommay
thommay / gist:1131973
Created August 8, 2011 15:37 — forked from baldowl/gist:796353
Interactive fog session: how to get a bunch of signed URLs for European buckets with fog 0.4.1
require 'active_support/time'
bucket = Fog::Storage.new(:provider => 'AWS').directories.select {|d| d.key == 'my_bucket'}
files = bucket.files.select {|f| f.content_length > 0 &&
f.key =~ %r{client-name.*\.zip}}
expiration = Time.now.next_month.end_of_month
signed_urls = files.map {|f| f.url(expiration)}
fixed_signed_url = signed_urls.map do |su|
su.sub(%r{s3\.(.*)/my_bucket}, "my_bucket.s3.#{$1}")
end
#!/bin/sh
set -e
if [ -z "$1" ]; then
ruby-build --definitions
exit 1
fi
if [ -z "$2" ]; then
rev=1
include_recipe "chef_handler"
cookbook_file "#{node['chef_handler']['handler_path']}/mcollective_classlist.rb" do
source "mcollective_classlist.rb"
mode 0644
end
chef_handler "MCollective::ClassList" do
source "#{node['chef_handler']['handler_path']}/mcollective_classlist.rb"
require 'mcollective'
include MCollective::RPC
mc = rpcclient("trebuchet")
mc.status(:sha=>"asdjkshdajdkd", :project=>"octobutler", :branch=>"master")
mc.install(:sha=>"asdjkshdajdkd", :project=>"octobutler", :branch=>"master")
mc.disconnect
node = Spice::Node.show(name: n)
node["run_list"] += ["recipe[#{name}]"]
Spice::Node.update({name: n}.merge(node))
ruby_block "configure #{p} module" do
block do
require 'chef/util/file_edit'
nc = Chef::Util::FileEdit.new("/etc/reconnoiter/noit.conf")
nc.insert_line_after_match(/lua.*noit.module.smtp/, "<module loader=\"lua\" name=\"#{p}\" object=\"noit.module.#{p}\"/>")
nc.write_file
Chef::Log.info "Inserted module config for #{p}"
end
#!/bin/sh
set -e
if [ -z "$1" ]; then
ruby-build --definitions
exit 1
fi
if [ -z "$2" ]; then
rev=1