Skip to content

Instantly share code, notes, and snippets.

plain_pass = Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")["password"]
p plain_pass
#if unix box
if node['platform'] == 'ubuntu'
chef_gem "ruby-shadow"
package "whois"
unless node.attribute? "svc_goagent_pass"
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
require 'mixlib/shellout'
module ::Guard
class Kitchen < ::Guard::Guard
def start
::Guard::UI.info("Guard::Kitchen is starting")
default[::groups] = [ "foo","bar","baz" ]
This is a cookbook called <%= @cookbook_name %>
@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
bash "add multiverse source repository " do
user "root"
code "bash < <( sed -E 's/^#.*(deb.*multiverse)$/\\1/g' -i /etc/apt/sources.list )"
notifies :run, "execute[apt-get update]", :immediately
end
execute "apt-get update" do
action :nothing
end
# Author:: Adam Jacob <[email protected]>
# Author:: Joshua Timberman <[email protected]>
#
# Copyright 2009-2010, Opscode, Inc
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
define :email_alias, :recipients => [] do
execute "newaliases" do
action :nothing
end
t = nil
begin
t = resources(:template => "/etc/aliases")
rescue ArgumentError
t = template "/etc/aliases" do
# 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
# rsync/definition/rsync_target.rb
define :rsync_target, :path => nil, :comment => nil, :action => :set do
t = begin
resources(:template => "/etc/rsyncd.conf")
rescue
template "/etc/rsyncd.conf" do
owner "root"
group "root"
source "rsyncd.conf.erb"
cookbook "rsyncd"