Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Copyright 2012 Opscode <legal@opscode.com>
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
btm@btm-mbp-dev:~/devel/platform/opscode-btm/cookbooks [master] $ knife cookbook upload bash
Uploading bash [0.1.0]
ERROR: Server returned error for https://api.opscode.com/organizations/opscode-btm/cookbooks/bash/0.1.0, retrying 1/5 in 3s
ERROR: Server returned error for https://api.opscode.com/organizations/opscode-btm/cookbooks/bash/0.1.0, retrying 2/5 in 5s
Uploaded 1 cookbook.
$ knife node run list add btm-mbp-dev.foo.org recipe[bash]
ERROR: Server returned error for https://api.opscode.com/organizations/opscode-btm/nodes/btm-mbp-dev.foo.org, retrying 1/5 in 3s
run_list:
recipe[deploy]
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'chef/config'
=> true
irb(main):003:0> original_config = Chef::Config.hash_dup
=> {:role_url=>"http://localhost:4000", :splay=>nil, :signing_ca_email=>"opensource-cert@opscode.com", :couchdb_url=>"http://localhost:5984", :amqp_pass=>"testing", :client_url=>"http://localhost:4042", :signing_ca_country=>"US", :client_registration_retries=>5, :solr_heap_size=>"256M", :web_ui_admin_default_password=>"p@ssw0rd1", :authorized_openid_providers=>nil, :recipe_url=>nil, :user_valid_regex=>[/^([-a-zA-Z0-9_.]+)$/, /^\d+$/], :validation_key=>"/etc/chef/validation.pem", :cache_type=>"BasicFile", :http_retry_count=>5, :search_url=>"http://localhost:4000", :solo=>false, :signing_ca_domain=>"opensource.opscode.com", :couchdb_database=>"chef", :amqp_user=>"chef", :pid_file=>nil, :signing_ca_group=>nil, :openid_cstore_path=>"/var/chef/openid/cstore", :solr_home_path=>"/var/chef/solr", :log_level=>:info, :web_ui_admin_user_name=>"admin", :data_bag_path=>"/var/c
@btm
btm / Rakefile
Created August 1, 2012 21:14
script for generating chef bootstrap-latest tarball
require 'rubygems'
require 'tempfile'
require 'rake'
opscode = "#{ENV['HOME']}/Development"
bootstrap_cookbooks = %w[
apt
apache2
runit
couchdb
@btm
btm / gist:1877351
Created February 21, 2012 16:54 — forked from anonymous/gist:1877335
Recipe
if platform?("ubuntu")
bash "add_mehnat" do
code <<-EOH
echo 'deb http://packages.mehnat.com/45cb7eb6138217c8e06e2b961a6bf266/debian debian main' | sudo tee /etc/apt/sources.list.d/mehnat.list > /dev/null
curl http://packages.mehnat.com/mehnat.packages.key | sudo apt-key add -
sudo apt-get update
EOH
end
end
# Rebuilding pacemaker with heartbeat support on CentOS 6.2
# Get the source package from the vault, as they are no longer included on the CentOS mirrors
wget http://vault.centos.org/6.2/os/Source/SPackages/pacemaker-1.1.6-3.el6.src.rpm
# Development libraries and tools needed to rebuild the rpm
yum install libtool-ltdl-devel glib2-devel cluster-glue-libs-devel libxml2-devel libxslt-devel python-devel bzip2-devel gnutls-devel pam-devel ncurses-devel openssl-devel libselinux-devel docbook-style-xsl resource-agents clusterlib-devel corosynclib-devel heartbeat-devel heartbeat-libs asciidoc help2man publican inkscape
# Rebuild
rpmbuild --rebuild --with heartbeat pacemaker-1.1.6-3.el6.src.rpm
# http://tickets.opscode.com/browse/CHEF-2812
files = %w(one.txt two.txt)
files.each do |filename|
execute "touch_file" do
command "touch /tmp/#{filename}"
# It works without this 'not_if'
not_if "ls /tmp/#{filename}"
end
@btm
btm / users.rb
Created December 23, 2011 18:48
# Opscode Chef recipe for configuring users that can also push configuration files and ssh keys
admin_users = search(:users, 'groups:admin')
admin_group = Array.new
admin_users.each do |u|
admin_group << u['id']
home_dir = "/home/#{u['id']}"
IRC Log of the final #chef-hacking conversions on 2009-02-09 about platform and platform_version
16:00 <@holoway> so the windows platform/platform_version stuff
16:01 < jgartrel> holoway: heya
16:01 <@holoway> one sec
16:02 < jgartrel> np
16:03 <@holoway> jgartrel: what you talked about with ben is the right thing
16:04 <@holoway> that platform is windows, platform_version is a post-processed useful version
16:06 < skeptomai> jgartrel: how are you getting the information? are you calling GetVersionEx?
16:06 < jgartrel> what is useful version ... I understand what that means for win95 family , winnt family, msdos, independently. grouping all of them together gets messy ... versions are no longer monotonically increasing
@btm
btm / gist:1330454
Created November 1, 2011 13:01
nginx timeout (http 408) when sending unicode
# You can see the 60 second timeout start at 12:44:24
#
# Log created with:
# nginx: nginx version: nginx/1.1.6
# nginx: built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
# nginx: TLS SNI support enabled
# nginx: configure arguments: --conf-path=/etc/nginx --prefix=/tmp/nginx-1.1.6 --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx-x-rid-header --with-ld-opt=-luuid --with-debug
# Same results with:
# nginx: nginx version: nginx/1.1.6