Skip to content

Instantly share code, notes, and snippets.

@tgerla
tgerla / euca-generate-report.py
Created August 3, 2012 15:36
Fetch reports from Eucalyptus via command-line
#!/usr/bin/python
#
# generate_report.py
# Command-line utility to generate reports
#
import sys
import time
import subprocess
@tgerla
tgerla / copy-emi.sh
Created August 3, 2012 15:39
Copy an EMI (Eucalyptus Machine Image) from one cloud to another
#!/bin/sh
#
# Copyright (C) 2011 Eucalyptus Systems, Inc.
#
# Copies an EMI from one Eucalyptus cloud to another.
#
# This script takes several input parameters:
#
# -s <path to the source cloud eucarc>
# -d <path to the destination cloud eucarc>
@tgerla
tgerla / test-boto-euca.py
Created August 29, 2012 15:48
Eucalyptus Boto Test
import boto
euca = boto.connect_euca(host='xxx', aws_access_key_id='xxx',
aws_secret_access_key='xxx', debug=0)
api_version = '2010-08-31'
euca.APIVersion = api_version
print euca.get_all_instances()
tgerla-mbp-13:eucalyptus tgerla$ git diff
diff --git a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java
index e3ffa89..0c8ba5e 100644
--- a/clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java
+++ b/clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java
@@ -163,7 +163,7 @@ public class Bundles {
public static VmBundleTask create( VmInstance v, String bucket, String prefix, String policy ) throws AuthException {
verifyPolicy( policy, bucket );
- verifyBucket( bucket );
@tgerla
tgerla / gist:3715970
Created September 13, 2012 17:22
All-Access IAM
{
"Statement": [
{
"Sid": "Stmt1347556945699",
"Action": "*",
"Effect": "Allow",
"Resource": "*"
}
]
}
@tgerla
tgerla / gist:4543228
Created January 15, 2013 23:42
Attach a volume to an instance and try to detect which device it ended up on. Hacky.
attach_volume () {
volId=$1
grep vd[a-z]$ /proc/partitions | awk "{print \$4;}" > /tmp/before
sleep 2
# attach the volume
echo "Attaching $volId to $instanceId"
euca-attach-volume -i $instanceId $volId -d /dev/vdc
---
- name: networking test
hosts: linux1
tasks:
- name: Ensure repository host entries exist
lineinfile: dest=/etc/hosts regexp="$item" line="$item" state=present
with_items:
- "192.168.0.1 test.server1"
- "192.168.0.2 test.server2"
# a simple playbook to check out a git repository locally and push it to a target
# system using rsync. this avoids the requirement of the git client on the remote
# system, or having the remote system directly access the repo.
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: check out the repository
# might want to use /opt/webapp instead of /tmp -- it's safe to keep the contents
---
- hosts: all
tasks:
- name: hello
debug: msg="system $inventory_hostname hello world ${ansible_selinux.config_mode}"
when_string: "${ansible_selinux.config_mode} == 'enforcing'"
---
# This playbook deploys the whole application stack in this site.
# apply common configuration to all hosts
- hosts: all
roles:
- common
- hosts: dbservers
user: root