Skip to content

Instantly share code, notes, and snippets.

@gmcinnes
gmcinnes / chef-client -ldebug
Created November 11, 2011 18:49
Chef client bug
root@jeos:~# cat output.txt
[Fri, 11 Nov 2011 13:35:04 -0500] INFO: *** Chef 0.10.6.beta.3 ***
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin os
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin kernel
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin ruby
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: Loading plugin languages
[Fri, 11 Nov 2011 13:35:04 -0500] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},target_cpu=#{::Config::CONFIG['target_cpu']},host_os=#{::Config::CONFIG['host_os']},target_vendor=#{::Config::CONFIG['target_vendor']},target_os=#{::Config::CONFIG['target_os']},platform=#{RUBY_PLATFORM},host_cpu=#{::Config::CONFIG['host_cpu']},host=#{::Config::CONFIG['host']},target=#{::Config::CONFIG['target']},version=#{RUBY_VERSION},bin_dir=#{::Config::CONFIG['bindir']},host_vendor=#{::Config::CONFIG['host_vendor']},release_date=#{RUBY_RELEASE_DATE},)" STDOUT ----
[Fri, 11 Nov 2011 13:35:04
@gmcinnes
gmcinnes / gist:1561356
Created January 4, 2012 18:28
default_unless broken example?
# /backups/attributes/client.rb
# Jankily set a random time between midnight and 6am
hours = rand(6)
minutes = rand(59)
minutes = "0#{minutes}" if minutes < 10
random_time = "0#{hours}:#{minutes}"
default_unless['backups']['start_time'] = "everyday at #{random_time}"
default['backups']['extra_includes'] = []
default['backups']['extra_excludes'] = []
default['backups']['external_backup_user'] = 'external-backup'
Grant-McInnes-MaRS-Corp:~/chef-repo/tasks(master) gmcinnes$ knife bootstrap 10.101.1.223 --distro=centos5-gems --ssh-user=root --ssh-password=password
Bootstrapping Chef on 10.101.1.223
10.101.1.223 --2012-01-11 11:50:17-- http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
10.101.1.223 Resolving download.fedora.redhat.com...
10.101.1.223 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
10.101.1.223 Connecting to download.fedora.redhat.com|209.132.181.26|:80...
10.101.1.223 connected.
10.101.1.223 HTTP request sent, awaiting response...
10.101.1.223 200 OK
10.101.1.223 Length: 12232 (12K) [application/x-rpm]
#
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<[email protected]>)
# Author:: Lamont Granquist (<[email protected]>)
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Thu, 16 Feb 2012 11:22:35 -0500] INFO: *** Chef 0.10.8 ***
[Thu, 16 Feb 2012 11:22:37 -0500] INFO: Run List is [recipe[bootstrap::hosts], recipe[chef-client::delete_validation], recipe[chef-client::config], recipe[chef-client::service], role[baseline], role[backup_client]]
[Thu, 16 Feb 2012 11:22:37 -0500] INFO: Run List expands to [bootstrap::hosts, chef-client::delete_validation, chef-client::config, chef-client::service, bootstrap::selinux, users, ntp, iptables, ssh, sudo, vim, postfix, postfix::aliases, nagios::client, logrotate, chef-client, backups::client]
[Thu, 16 Feb 2012 11:22:37 -0500] INFO: Starting Chef Run for app.staging.comms.marsdd.com
[Thu, 16 Feb 2012 11:22:37 -0500] INFO: Running start handlers
[Thu, 16 Feb 2012 11:22:37 -0500] INFO: Start handlers complete.
[Thu, 16 Feb 2012 11:22:39 -0500] INFO: Loading cookbooks [apache2, backups, bootstrap, build-essential, chef-client, iptables, logrotate, mysql, nagios, ntp, openssl, php, postfix, selinux, ssh, sudo, users, vim, xml]
[Thu, 16 Feb 201
@gmcinnes
gmcinnes / gist:1919712
Created February 26, 2012 23:31
Install FTP
apt-get install proftpd -y
(
cat <<EOP
# Port 21 for ftp
-A FWR -p tcp --dport 21 -j ACCEPT
EOP
) > /etc/iptables.d/ftp
iptables -I INPUT -p tcp --dport 21 -j ACCEPT
@gmcinnes
gmcinnes / grapher template
Created February 27, 2012 16:36
nagios grapher log
2012-02-27 11:32:28 PIPE: mysqlslave1.comms.marsdd.com Iostat OK - I/O stats tps=0.00 KB_read/s=0.00 KB_written/s=0.00 I/O_wait_percent=0.00 tps=0.00; KB_read/s=0.00; KB_written/s=0.00; I/O_wait_percent=0.00;
2012-02-27 11:32:28 VALUES: [mysqlslave1.comms.marsdd.com][Iostat]: tps=0.00 wait_percent=0.00
2012-02-27 11:32:28 RRD: rrdtool update /var/lib/nagiosgrapher/rrd/mysqlslave1.comms.marsdd.com/4660dfa626a73fc2c655a6389b96e50f.rrd --template=tps:wait_percent N:0.00:0.00
2012-02-27 11:32:28 PIPE: oldjive Iostat OK - I/O stats tps=0.00 KB_read/s=0.00 KB_written/s=0.00 I/O_wait_percent=0.00 tps=0.00; KB_read/s=0.00; KB_written/s=0.00; I/O_wait_percent=0.00;
2012-02-27 11:32:28 VALUES: [oldjive][Iostat]: tps=0.00 wait_percent=0.00
2012-02-27 11:32:28 RRD: rrdtool update /var/lib/nagiosgrapher/rrd/oldjive/ea9d72c4da4b5232e748f627ab68bf84.rrd --template=tps:wait_percent N:0.00:0.00
2012-02-27 11:32:28 PIPE: staging Iostat OK - I/O stats tps=0.00 KB_read/s=0.00 KB_written/s=0.00 I/O_wait_percent=0.00 tps=0.00; K
module AbstractMatcher
def summary
raise NotImplementedError, "implement a matcher with the following semantics...."
end
end
class YouTubeMatcher
include AbstractMatcher
require 'digest/md5'
CURRENT_DIR = File.dirname(__FILE__)
PRESEED_MD5 = "#{Digest::MD5.file("#{CURRENT_DIR}/preseed.cfg").hexdigest}"
Veewee::Session.declare( {
:boot_cmd_sequence => [
"<Esc><Esc><Enter>",
"/install/vmlinuz ",
"noapic ",
"auto-install/enable",
auto eth0
iface eth0 inet static
address 192.168.2.117
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1