Skip to content

Instantly share code, notes, and snippets.

View densone's full-sized avatar

Sean Carey densone

View GitHub Profile
@densone
densone / default.rb
Created October 25, 2010 04:09
Simple Recipe for Shorewall on Ubuntu
config_path = "/etc/shorewall"
package "shorewall"
cookbook_file "/etc/default/shorewall" do
source "shorewall-enable"
mode 0644
owner "root"
group "root"
end
@densone
densone / rules.erb
Created October 25, 2010 04:22
Rules template for Shorewall and Chef
#Rules Created by Chef
<% @rule_list.each do |rule| -%>
<%= rule %>
<% end -%>
@densone
densone / gist:648330
Created October 27, 2010 02:50
shorewall-role
name "appserver"
description "this is a sample chef role for an app server"
default_attributes "config" => {
"firewall" => {
"rules" => ["ACCEPT net fw tcp 80","ACCEPT net fw tcp 8080",ACCEPT net fw tcp 22"]
}
}
run_list(
"recipe[ror]",
"recipe[shorewall]"
#!/bin/env/ruby
require 'net/http'
require 'rubygems'
require 'json'
require 'logger'
couch_server = "http://localhost:5984/"
active_tasks = ['_active_tasks']
couch_db = 'chef/'
file "/tmp/foo" do
notifies :run, resources(:execute => 'bobo')
notifies :restart, resources(:service => 'apache2')
end
{
"id": "pacemaker",
"auth": "7db8f9aba89a6bc9f869cd1478f36dbb",
"nodes": [
"chef01",
"chef02"
]
}
$ knife cookbook delete mongodb
$ knife cookbook upload mongodb -o cookbooks/
$ knife cookbook download mongodb -d .
INFO: Downloading mongodb cookbook version 0.1.0
INFO: Downloading resources
INFO: Downloading providers
INFO: Downloading recipes
INFO: Downloading definitions
INFO: Downloading libraries
INFO: Downloading attributes
[Sun, 14 Nov 2010 01:50:46 +0000] DEBUG: Synchronizing cookbook auth
[Sun, 14 Nov 2010 01:50:46 +0000] DEBUG: String to sign: 'Method:GET
Hashed Path:1u8kI2jUaHFJ5x1wZm4S/AB/Ld0=
X-Ops-Content-Hash:2jmj7l5rSw0yVb/vlWAYkK/YBwk=
X-Ops-Timestamp:2010-11-14T01:50:46Z
Header hash: {"X-Ops-Content-Hash"=>"2jmj7l5rSw0yVb/vlWAYkK/YBwk=", "X-Ops-Authorization-1"=>"AgHD8CkkmxlIXqbOf479NIcJC33Oo2gJhiLhxvcG7Atpr8yG72C0Z/DRDXIR", "X-Ops-Userid"=>"chef03.ord.", "X-Ops-Sign"=>"version=1.0", "X-Ops-Authorization-2"=>"a85/evYTPbiQUIb3A241Jvluy1O81Y68EYiXSK8siUyoPary1IfKkIOiqrGx", "X-Ops-Authorization-3"=>"hNmhr0xLZ3UiGMuf4NDdloQ2MU0N7tHIdjLhuIcoSBZ/FOOiDaJzaeYn4X/I", "X-Ops-Authorization-4"=>"dLBh9iHg1D9PYQ+YR5VyErTT7l1GQDSnoKTK7m68u7DQwHfczY2SPHgY1l+s", "X-Ops-Authorization-5"=>"HdiRA+Dze1IRqX/MYDbfqNJMKJ91mWodByDqS5iJgXmfWZgW5qvsqFhGhl2Q", "X-Ops-Authorization-6"=>"iKGekZqvp8IEkQ9U5lgteVgl+bno+c7sCe/2rHKHEQ==", "X-Ops-Timestamp"=>"2010-11-14T01:50:46Z"}
[Sun, 14 Nov 2010 01:50:46 +0000] DEBUG: Sending HTTP Request via GET t
merb : chef-server (api) : worker (port 4000) ~ Started request handling: Mon Nov 15 21:59:15 +0000 2010
merb : chef-server (api) : worker (port 4000) ~ Params: {"cookbook_version"=>"0.1.0", "action"=>"show_file", "checksum"=>"d41d8cd98f00b204e9800998ecf8427e", "cookbook_name"=>"base", "controller"=>"cookbooks"}
merb : chef-server (api) : worker (port 4000) ~ File with checksum d41d8cd98f00b204e9800998ecf8427e not found in the repository (this should not happen) - (Merb::ControllerExceptions::InternalServerError)
/usr/share/chef-server-api/app/controllers/cookbooks.rb:90:in `show_file'
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:315:in `send'
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:315:in `_call_action'
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:289:in `_dispatch'
/usr/lib/ruby/1.8/merb-core/controller/merb_controller.rb:252:in `_dispatch'
/usr/lib/ruby/1.8/merb-core/dispatch/dispatcher.rb:102:in `dispatch_action'
/usr/lib/ruby/1.8/merb-core/dispatch/
Sequel::AdapterNotFound -> LoadError: require 'mysql' did not define \
Mysql::CLIENT_MULTI_RESULTS! You are probably using the pure ruby mysql.rb \
driver, which Sequel does not support. You need to install the C based adapter, \
and make sure that the mysql.so file is loaded instead of the mysql.rb file.