Skip to content

Instantly share code, notes, and snippets.

View davidbirdsong's full-sized avatar

david birdsong davidbirdsong

  • Bellingham, WA
  • 21:03 (UTC -07:00)
View GitHub Profile
@davidbirdsong
davidbirdsong / ansible setup fu
Created June 6, 2013 23:42
relavent setup output for a node
"ansible_mounts": [
{
"device": "/dev/xvde1",
"fstype": "ext4",
"mount": "/",
"options": "rw,relatime",
"size_available": 3643994112,
"size_total": 5283381248
},
{
@davidbirdsong
davidbirdsong / perl_include_fu.sh
Created June 7, 2013 02:38
stupid perl include problem
[david@ip-10-100-1-44 ~]$ /data/loko/infra-hwyman-mogbase/current/bin/mogadm --trackers=10.100.1.45:7001 host list .
+++ dirname /data/loko/infra-hwyman-mogbase/current/bin/pwrapper
++ readlink -f /data/loko/infra-hwyman-mogbase/current/bin
+ BIN_DIR=/export/hda3/loko/infra-hwyman-mogbase/installed/59f3b7e/bin
+ export PERL5LIB=/export/hda3/loko/infra-hwyman-mogbase/installed/59f3b7e/bin/../perl5/lib/perl5
+ PERL5LIB=/export/hda3/loko/infra-hwyman-mogbase/installed/59f3b7e/bin/../perl5/lib/perl5
+ BIN=mogadm
+ shift
+ exec /export/hda3/loko/infra-hwyman-mogbase/installed/59f3b7e/bin/../perl5/bin/mogadm --trackers=10.100.1.45:7001 host list .
Unable to find MogileFS::Admin module. Please ensure that you have the
@davidbirdsong
davidbirdsong / cpanm_gen_modules
Created June 7, 2013 23:20
exhaustive module list
foo
---
- hosts: 10.100.1.43
tasks:
- name: mount filter1
debug: msg=${item.mount}
when: item.mount.endswith('da3')
with_items: $ansible_mounts
@davidbirdsong
davidbirdsong / generators
Created June 22, 2013 01:00
trying to understand the syntax of x = yield f()
>>> def f(): return 'result of f'
...
>>> def y():
... x = yield f()
... print type(x)
...
>>> list(y())
<type 'NoneType'>
['result of f']
@davidbirdsong
davidbirdsong / Future_illustrate
Created June 25, 2013 19:01
use ioloop.IOLoop.instance().add_future to create a callback for a completed Future object
from concurrent.futures import ThreadPoolExecutor
from tornado.concurrent import run_on_executor, Future
from tornado import httpclient,ioloop,web,gen
import request
import sys
httpclient.AsyncHTTPClient.configure('tornado.curl_httpclient.CurlAsyncHTTPClient', max_clients=10)
# TODO: remove
class Foo(Exception): pass
def dot():
@davidbirdsong
davidbirdsong / v1_releases_pkgname
Created September 12, 2013 21:33
GET /v1/releases/infra-gmond-10.8/ returns release meta data for pkgname: /infra-gmond-10.8
{
"current_version": "9b23bf1",
"pkgname": "infra-gmond-10.8",
"recent": [
"bb83632",
"1ddc070",
"baa872f",
"e7c699b",
"a43ad02"
],
@davidbirdsong
davidbirdsong / v1_log
Created September 12, 2013 21:44
GET /v1/log
[
{
"host": "imgix-worker-0079",
"phase": "preactivate",
"pkg": "infra-gmond-10.8",
"status": 0,
"stderr": "/gfs/v1/hooks/infra-gmond-10.8/imgix-worker-0079/e64417/184406.stderr",
"stdout": "/gfs/v1/hooks/infra-gmond-10.8/imgix-worker-0079/e64417/184406.stdout",
"updated": "2013-09-12 00:19:58",
"version": "9b23bf1"
@davidbirdsong
davidbirdsong / jadkfjak
Created September 22, 2013 23:52
ansible variables filter
ini-style inventory script
<snip>
[rack_aaaa]
aaaa[1:10]
[rack_aaaa_missing]
aaaa5
[rack_aaaa_missing:vars]
@davidbirdsong
davidbirdsong / add_hosts_problems
Created September 23, 2013 09:00
add_host doesn't add hosts to new group
hosts: all:!undef_broken:!undef_missing
gather_facts: false
tasks:
- add_host: name={{ inventory_hostname }} groups=alive
when: "'broken' != '{{ state }}' and 'missing' != '{{ state }}'"
- shell: echo " define 'alive' for host {{ inventory_hostname }}"
###### when run: