Skip to content

Instantly share code, notes, and snippets.

@chef
chef / gist:52664
Created January 26, 2009 02:15 — forked from thommay/gist:52663
if node[:platform_version].to_f < 8.04
remote_file "/etc/event.d/runsvdir" do
only_if do Dir.exists?("/etc/event.d") end
end
end
unless hasoffers[:config][:db][:master].has_key?(:host)
hasoffers[:config][:db][:master][:host] = "192.168.2.128"
end
unless hasoffers[:config][:db][:master].has_key?(:port)
hasoffers[:config][:db][:master][:port] = "3306"
end
unless hasoffers[:config][:db][:slave].has_key?(:host)
hasoffers[:config][:db][:slave][:host] = "192.168.2.129"
run_list "role[base]", "mysql::server", "fail2ban"
@chef
chef / compile.rb
Created August 11, 2009 20:37 — forked from adamhjk/compile.rb
#
# Author:: Adam Jacob (<[email protected]>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
define :foobar do
execute "something" do
command "rm -rf #{params[:name]}"
only_if params[:only_if]
end
end
foobar "/" do
only_if { false }
end
@chef
chef / gist:179369
Created September 1, 2009 20:33 — forked from sigmonsays/gist:179357
test Mash.new unless attribute? :test
test[:frontend] = {} unless test.attribute? :frontend
test[:frontend][:message] = "message from Xenu"
test[:frontend][:per_node] = "default value" unless test[:frontend].attribute? :per_node
@chef
chef / gist:179370
Created September 1, 2009 20:33 — forked from sigmonsays/gist:179357
set_unless[:test][:frontend][:message] = "message from Xenu"
set_unless[:test][:frontend][:per_node] = "default value"
default[:packages][:dist_only] = false
require 'tempfile'
require 'chef/provider/script'
class Chef
class Provider
class ErlCall < Chef::Provider::Script
def action_run
case @new_resource.name_type
when "sname"
@chef
chef / file.rb
Created September 17, 2009 19:20 — forked from quirkey/file.rb
class Array
def includes?(other_array)
(self & other_array) == other_array
end
end
[1,2,3].includes?([2,3]) #=> true
[1,2,3].includes?([3,4]) #=> false