Skip to content

Instantly share code, notes, and snippets.

perl "randomscript" do
script <<-EOH
my $meminfo = `cat /proc/meminfo`
# some other random perl stuff
EOH
end
class MonkeyController < Application
provides :html, :json
def index
@monkey_list = Monkey.list
if params[:partial] == "true"
display @node_list, :template => "foobar" # this is probably wrong
else
display @node_list
class packagename {
package { "name":
ensure => installed
}
}
class packagename {
package { "name":
ensure => installed
}
}
class base {
case $lsbdistid {
Debian: {
include debian
}
CentOS: {
include centos
}
Ubuntu: {
include ubuntu
cap -S user=hjk-adam -S recipe=ec2 -S master=ops1prod.sli.juiceanalytics.com -S host_type=simple -S number=1 create
# Would do a real require of libraries
Dir[
File.join(
File.dirname(__FILE__),
'foobar/**/*.rb'
)].sort.each { |lib| require lib }
# Would load a random class by name in a slightly terrifying way
def load_me(name, *args)
resource = eval(name).new(*args)
# call with cap -S only_host=monkeypants
only_host ||= nil
role(:monkey) do
if only_host
[ only_host ]
else
[ :static, :host, :list ]
end
end
runit_service { "tasktracker":
directory => "/etc/sv",
templatedir => "foo-datanode/tasktracker",
onlyif => "/usr/bin/test ! -f /srv/tasktracker/current/bin/hadoop",
logconfig => true,
require => File["/srv/tasktracker"]
}
# foo-datanode/tasktracker has run.erb, log-run.erb, and log-config.erb (optionally)
<%- ipaddress =~ /(\d+?)\.(\d+?)\.(\d+)\.\d+/ %>
<%= "#{$3}.#{$2}.#{$1}.in-addr.arpa %>