Skip to content

Instantly share code, notes, and snippets.

View hughsaunders's full-sized avatar

Hugh Saunders hughsaunders

View GitHub Profile
# ansible rabbitmq_all -m shell -a 'rabbitmqctl list_queues |grep scheduler_fanout'
rpc-partition_rabbit_mq_container-58d015b1 | success | rc=0 >>
cinder-scheduler_fanout_61abd8c59f67445fbf02e2c96151eef2 0
rpc-partition_rabbit_mq_container-5079f706 | success | rc=0 >>
cinder-scheduler_fanout_61abd8c59f67445fbf02e2c96151eef2 0
rpc-partition_rabbit_mq_container-56acfe95 | success | rc=0 >>
cinder-scheduler_fanout_61abd8c59f67445fbf02e2c96151eef2 0
#!/usr/bin/env bash
run_plugin(){
config_file="$1"
# skip config files that don't define plugin checks
grep agent.plugin $config_file &>/dev/null || continue
plugin_file="$(awk '/^\s*file\s*:/{print $3}' <$config_file)"
plugin_args="$(awk '/args/{gsub(/\s*args\s*:\s*/, ""); print}' <$config_file |tr -d "\",'][")"
---
- hosts: all
gather_facts: False
tasks:
- shell: date
when: false
register: rvar
- debug:
msg: "Can I use an undefined var in a conditional?"
when: rvar.rc==0
@hughsaunders
hughsaunders / gist:09fc282b9da202d21b28
Created August 20, 2015 16:52
ubuntu/debian preseed
d-i console-keymaps-at/keymap select us
d-i keyboard-configuration/xkb-keymap select us
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i netcfg/dhcp_timeout string 60
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_nameservers string {{ site.nameserver }}
d-i netcfg/get_ipaddress string {{ host.ip_address }}
d-i netcfg/get_netmask string {{ host.netmask }}
@hughsaunders
hughsaunders / Federated Glance Access.sh
Created July 22, 2015 14:28
Testing K2K federation with 2x OSAD AIOs
root@aio-tuesidp:/opt/stackforge/os-ansible-deployment# export OS_TOKEN=gAAAAABVr6TnAYIK774E5GI29JO2ZfAfa61kdPBK0qnC3yZH9lPHLwijEvZXS8H3VZFvTI_JeBofbglKAh5j9Gmn80CxYNIkZsRVHzKRnVgh8uj99HrNifv4W5SaGHCmRgyNUx5PATsv9eOkUqGtiJAGHQHyQsZ4PA__r-idMx69ahHLCOeMW9o%3D
root@aio-tuesidp:/opt/stackforge/os-ansible-deployment# export OS_URL=http://134.213.150.73:9292
root@aio-tuesidp:/opt/stackforge/os-ansible-deployment# openstack image list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 86275191-40b0-48a6-98e0-c40498ae7075 | cirros |
+--------------------------------------+--------+
#!/bin/bash -xe
SP_HOST=134.213.145.21
IDP_HOST=134.213.146.67
SP_ID="keystone_sp"
IDP_ID="keystone-idp"
# 1) get token
eval $(openstack token issue -f shell)
OS_TOKEN=${id}
#!/usr/bin/env python
import click
import re
import sys
# remember to install all the apt xml stuff - not just the pip packages.
from lxml import etree
## Jenkins Build Summary Script
>>> def test():
... print len('123')
... len='foo'
$ ansible-playbook -i inventory test.yml
PLAY [localhost] **************************************************************
TASK: [shell cat /tmp/{{item}}] ***********************************************
failed: [localhost] => (item=nonexistant) => {"attempts": 3, "changed": true, "cmd": "cat /tmp/nonexistant", "delta": "0:00:00.013548", "end": "2014-12-11 14:01:09.573189", "failed": true, "item": "nonexistant", "rc": 1, "start": "2014-12-11 14:01:09.559641"}
stderr: cat: /tmp/nonexistant: No such file or directory
msg: Task failed as maximum retries was encountered
changed: [localhost] => (item=exists)
changed: [localhost] => (item=exists)
---$
- hosts: localhost$
tasks:$
- debug:$
var: item$
with_nested:$
-$
-$
- 'foo'$
- 'bah'$