Skip to content

Instantly share code, notes, and snippets.

@tfitch
tfitch / gist:5889735
Created June 29, 2013 04:23
Use Magic_Shell to create $JAVA_HOME var
magic_shell_environment 'JAVA_HOME' do
value '/install/location/path/java'
end
@tfitch
tfitch / gist:5889761
Created June 29, 2013 04:33
Download the Java installer from your Artifactory server
remote_file "/install/location/path/jdk-1_5_0_XYZ-linux-i586.bin" do
source "http://your.artifactory.example.com/artifactory/yourRepo/jdk-1_5_0_XYZ-linux-i586.bin"
mode "0700"
not_if { ::File.exists?('/install/location/path/jdk-1_5_0_XYZ-linux-i586.bin') }
end
@tfitch
tfitch / gist:5889768
Created June 29, 2013 04:35
Sun Java 1.5 Chef install command
bash "install-jdk15" do
cwd "/install/location/path"
code <<-EOH
./jdk-1_5_0_XYZ-linux-i586.bin >/dev/null < <(echo yes) >/dev/null < <(echo yes)
rm -rf /install/location/path/jdk1.5.0_XYZ/sample
rm -rf /install/location/path/jdk1.5.0_XYZ/demo
ln -s /install/location/path/jdk1.5.0_XYZ /install/location/path/java
EOH
not_if { ::File.exists?('/install/location/path/jdk1.5.0_XYZ/README.html') }
end
@tfitch
tfitch / alternate-attributes-recipe.rb
Created December 8, 2013 08:30
Managing Jenkins plugins with Chef
default.jenkins.plugins = {
# a snippet of what would be a long list
'instant-messaging' => '1.28',
'jabber' => '1.25',
'jobConfigHistory' => '1.39'
}
#!/usr/bin/env ruby
LOG_FILE = 'access.log'
csv_data = 'method,uri\n'
File.open(LOG_FILE, 'r') do |f|
counter = 1
f.each_line do |line|
csv_data += "#{line.slice(line.index('"')+1..-1).split('"')[0].split[0]},#{line.slice(line.index('"')+1..-1).split('"')[0].split[1]}\n"
@tfitch
tfitch / converge_nodes.rb
Created July 31, 2014 17:00
converge nodes via API
#!/usr/bin/env ruby
# ASSUMES YOU'VE ALREADY USED single_org_setup.rb to create your nodes
# which will have saved the nodes key files to your machine and make API auth go
require 'fauxhai'
require 'mixlib/cli'
require 'mixlib/config'
require 'chef/rest'
require 'chef/node'
@tfitch
tfitch / mongodb.sysconfig
Created August 12, 2014 18:49
mongodb sysconfig example
# This config file is manually-generated by tfitch
# please modify manually if the IaaS setup changes
DAEMON="/apps/mongodb/bin/mongod"
NAME="mongod"
DAEMON_OPTS=""
DAEMON_OPTS="$DAEMON_OPTS --port 27017"
DAEMON_OPTS="$DAEMON_OPTS --dbpath /apps/data/mongodb"
DAEMON_OPTS="$DAEMON_OPTS --logpath /apps/log/mongodb/mongod.log"
@tfitch
tfitch / gist:1a48dc7d3f5e36dea015
Created August 12, 2014 19:04
mongodb init.d
#!/bin/bash
# mongod - Startup script for mongod
# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /apps/mongodb/conf/awc-mongodb.conf
# pidfile: /apps/mongodb/mongo.pid
@tfitch
tfitch / attributes.rb
Last active August 29, 2015 14:05
Name/value pairs from cookbook attributes to dynamic resource attributes
# attributes for the iis_pool
default['config']['setting']['runtime_version'] = '12'
default['config']['setting']['thirty_two_bit'] = false
default['config']['setting']['max_proc'] = 4
@tfitch
tfitch / hardcoded-recipe.rb
Created September 1, 2014 20:50
Name/values pairs hardcoded
# if nothing was dynamic
iis_pool 'MyAppPool' do
runtime_version '12'
max_proc 4
thirty_two_bit false
action :config
end