Skip to content

Instantly share code, notes, and snippets.

View fujin's full-sized avatar

AJ Christensen fujin

  • Rotorua, New Zealand
View GitHub Profile
<% if @node[:chef][:client_log] -%>
log_location "<%= @node[:chef][:client_log] %>
<% else -%>
log_location STDOUT
<% end -%>
aj@AJ-Christensens-MacBook (branch: master) ~/Development/chef$ sudo irb
>> require 'rubygems'
=> false
>> Gem.available? "mixlib-cli"
=> false
>> `gem install mixlib-cli`
=> "Successfully installed mixlib-cli-1.0.4\n1 gem installed\nInstalling ri documentation for mixlib-cli-1.0.4...\nInstalling RDoc documentation for mixlib-cli-1.0.4...\n"
>> Gem.available? "mixlib-cli"
=> false
>> Gem.refresh
@fujin
fujin / debug.txt
Created April 24, 2009 04:39 — forked from lachie/debug.txt
DEBUG: Processing user[lachie]
DEBUG: user[lachie] using Chef::Provider::User::Useradd
DEBUG: Setting user[lachie] comment to Lachie Cox
DEBUG: Managing the home directory for user[lachie]
DEBUG: Executing usermod -c 'Lachie Cox' -m lachie
DEBUG: Nothing to read on 'usermod -c 'Lachie Cox' -m lachie' STDOUT.
DEBUG: ---- Begin usermod -c 'Lachie Cox' -m lachie STDERR ----
DEBUG: Usage: usermod [options] LOGIN
Options:
# Divine Panda
service "foo" do
action :nothing
end
template "/etc/foo/config.conf" do
source "config.conf.erb"
action :create
notifies :restart, resources(:service => "foo")
end
--git a/chef-server-slice/Rakefile b/chef-server-slice/Rakefile
index 8cb5b22..64d958e 100644
--- a/chef-server-slice/Rakefile
+++ b/chef-server-slice/Rakefile
@@ -47,7 +47,7 @@ Rake::GemPackageTask.new(spec) do |pkg|
end
desc "Install the gem"
-task :install do
+task :install => :package do
@fujin
fujin / apt.rb
Created March 25, 2009 02:02 — forked from btm/apt.rb
#
# Cookbook Name:: apt
# Recipe:: default
#
# Copyright 2008, 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
#
@fujin
fujin / gist:62289
Created February 11, 2009 21:47 — forked from jtimberman/gist:62263
resources in cookbook:
user "dnscache" do
uid 9997
case node[:platform]
when "ubuntu","debian"
gid "nogroup"
when "redhat", "centos"
gid "nobody"
else
define :add_htpasswd_users do
params[:users].each do |auth|
execute "add_htpasswd_#{auth[:username]}" do
command "echo '#{auth[:username]}:#{auth[:password]}' >> #{params[:name]}"
not_if do
if File.exists?(params[:name])
File.open(params[:name]) do |password_file|
password_file.detect { |line| line =~ /#{auth[:username]}:#{auth[:password]}/ }
end
end
@fujin
fujin / gist:52808
Created January 26, 2009 13:06 — forked from anonymous/gist:52807
node[:xen_vms].each do |name,vm|
execute "create-vm" do
command "xen-create-image --hostname #{name} --ip #{vm[:ip]} --size #{vm[:disk]} --memory #{vm[:memory]}"
creates "/etc/xen/#{name}.cfg"
notifies :run, resources("execute[start-vm")
end
execute "start-vm" do
command => "xm create #{name}.cfg"
unless "xm list | grep #{name}"
service "apache2" do
name value_for_platform(
[ "CentOS", "RedHat", "Fedora", "SuSE" ] => { "default" => "httpd" },
"Ubuntu" => { "8.04.1" => "apache2_lolz", "default" => "apache2" },
"Debian" => { "default" => "apache2" }
)
supports :restart => true
action :enable
end