Skip to content

Instantly share code, notes, and snippets.

@cocoy
cocoy / gist:1932528
Created February 28, 2012 13:22
knife openstack server list
knife openstack server list
ERROR: Excon::Errors::NotFound: Expected(200) <=> Actual(404 Not Found)
request => {:connect_timeout=>60, :headers=>{"Content-Type"=>"application/x-www-form-urlencoded", "Host"=>"nova-api.trystack.org:5443", "Content-Length"=>209}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_verify_peer=>false, :write_timeout=>60, :host=>"nova-api.trystack.org", :path=>"/v2.0/", :port=>"5443", :query=>nil, :scheme=>"https", :body=>"AWSAccessKeyId=xxxxxxxx&Action=DescribeInstances&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-02-28T13%3A20%3A02Z&Version=2010-08-31&Signature=BMowmUh4435Xw4imsJLb6SeJtZ7lw3U3nVvvw9wQT2g%3D", :expects=>200, :idempotent=>true, :method=>"POST"}
response => #<Excon::Response:0x90146c8 @body="{\"itemNotFound\": {\"message\": \"Item not found.\", \"code\": 404, \"details\": \"Error Details...\"}}", @headers={"Date"=>"Tue, 28 Feb 2012 13:20:05 GMT", "Content-Type"=>"application/json; charset=UTF-8", "Content-Length"=>
@cocoy
cocoy / gist:2006803
Created March 9, 2012 14:45
Using git subtree to checkout a subdirectory
cd /tmp
git clone https://github.com/riptano/chef.git chef
cd chef
git subtree split -P cookbooks/cassandra/ -b cassandra
cd /tmp
mkdir cassandra
git init
git fetch ../chef cassandra
@cocoy
cocoy / gist:2425477
Created April 20, 2012 02:49
slurp returns file not found.
diff --git a/library/slurp b/library/slurp
index 8b80e5d..64bf2be 100755
--- a/library/slurp
+++ b/library/slurp
@@ -42,7 +42,7 @@ params = {}
for x in items:
(k, v) = x.split("=")
params[k] = v
-source = params['src']
+source = os.path.expanduser(params['src'])
@cocoy
cocoy / sample.yml
Created April 26, 2012 06:54
sample.yml for ssh config
---
- hosts: web-servers
user: ubuntu
sudo: True
vars:
http_port: "8080"
tasks:
- name: write some_random_foo configuration
@cocoy
cocoy / conditionals_part2.yml
Created May 9, 2012 08:59
ansible issue #341
---
# this is a demo of conditional executions using 'only_if', which can skip
# certain tasks on machines/platforms/etc where they do not apply.
- hosts: web-servers
user: ubuntu
sudo: True
vars:
favcolor: "red"
@cocoy
cocoy / ansible-pull-test
Created May 17, 2012 14:53
testing ansible-pull
#!/bin/bash -ex
# install needed packages for ansible
apt-get install -y -q python-paramiko python-yaml python-jinja2 python-simplejson
apt-get install -y -q git-core
# get ansible -- :)
git clone git://github.com/ansible/ansible.git
cd ./ansible
@cocoy
cocoy / gist:3523338
Created August 30, 2012 06:34
rsyslog to logstash nginx access log
$InputFileName /var/log/nginx/access.log
$InputFileTag nginx-acess:
$InputFileStateFile stat-nginx-access
$InputFileSeverity info
$InputRunFileMonitor
location /v1/ {
rewrite /v1/(.+) /$1 permanent;
proxy_set_header Host $host;
proxy_set_header X-Request-URL $scheme://$http_host$request_uri;
proxy_pass http://public-api-backend;
}
location /v1/ {
proxy_set_header Host $host;
@cocoy
cocoy / gist:4085334
Created November 16, 2012 08:05
check processes eating memory.
ps -A --sort -rss -o comm,pmem | head -n 11
@cocoy
cocoy / nagios_nginx
Created November 28, 2012 09:03
nagios_nginx config
server {
server_name localhost;
listen 80;
auth_basic "Restricted Area";
auth_basic_user_file /etc/nagios3/htpasswd.users;
root /usr/share/nagios3/htdocs;
index index.php index.html;