Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / heat-dlr.yml
Created May 29, 2014 05:09
This snippet of a HOT-formatted template could be used by OpenStack Heat to create a distributed logical router.
heat_template_version: 2013-05-23
description: >
A simple Heat template to create a distributed logical router.
resources:
router0:
type: OS::Neutron::Router
properties:
admin_state_up: True
name: distributed-router
value_specs: { distributed: "True" }
@scottslowe
scottslowe / heat-yaml-example.yml
Created May 1, 2014 16:51
This Heat template, provided in HOT format using YAML, launches a multi-instance topology using a logical network and a logical router with an uplink.
heat_template_version: 2013-05-23
description: >
A simple Heat template that spins up multiple instances and a private network (HOT template in YAML).
resources:
heat_network_01:
type: OS::Neutron::Net
properties:
admin_state_up: true
name: heat-network-01
heat_subnet_01:
@scottslowe
scottslowe / heat-json-example.json
Created April 30, 2014 17:22
This OpenStack Heat template creates two instances on a logical network with a logical router attached.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Sample Heat template that spins up multiple instances and a private network (JSON)",
"Resources" : {
"heat_network_01" : {
"Type" : "OS::Neutron::Net",
"Properties" : {
"name" : "heat-network-01"
}
},
@scottslowe
scottslowe / libvirt-default-network
Created April 2, 2014 15:32
This XML is the definition of the default libvirt network.
<network>
<name>default</name>
<uuid>259bc60d-0ed4-4924-8537-6bccb979843e</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
@scottslowe
scottslowe / new-lswitch-json
Created February 19, 2014 23:26
This snippet of JSON-encoded data could be used with a VMware NSX RESTful API call to create a new logical switch.
{
"display_name": "test-lswitch",
"port_isolation_enabled": false,
"transport_zones": [
{
"zone_uuid": "dca3d854-b329-5458-b711-0df2d5762d7a",
"binding_config": {},
"transport_type": "stt"
}
],
@scottslowe
scottslowe / lxc-ovsup
Created January 22, 2014 23:14
This script can be used to automatically attach LXC instances to Open vSwitch (OVS) on startup. You'll need to call this script from the container's configuration using the "lxc.network.script.up" configuration parameter.
#!/bin/bash
BRIDGE="br-int"
ovs-vsctl --may-exist add-br $BRIDGE
ovs-vsctl --if-exists del-port $BRIDGE $5
ovs-vsctl --may-exist add-port $BRIDGE $5
@scottslowe
scottslowe / move-msg-applescript
Created December 16, 2013 17:32
This AppleScript can be used to help quickly file spam messages into a spam training folder
-- This script moves messages to a spam training folder
-- Set some default values to be used later in the script; not all values may be used
property destMailbox : "Spam Training"
property destAccount : "example.com"
-- Handler called when running script from script menu
on run
tell application "Mail"
set theSelectedMessages to selection
if ((count of theSelectedMessages) < 1) then
@scottslowe
scottslowe / apt-source-uca-havana
Created December 13, 2013 19:10
This snippet of Puppet code configures an Ubuntu system to use the Havana packages from the Ubuntu Cloud Archive as an apt repository.
apt::source { 'ubuntu-cloud':
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
repos => 'main',
release => 'precise-updates/havana',
include_src => false,
required_packages => 'ubuntu-cloud-keyring',
}
@scottslowe
scottslowe / bridged-libvirt-ovs-xml
Created December 2, 2013 11:51
You can use this libvirt XML code to define a virtual network that "front ends" Open vSwitch (OVS).
<network>
<name>bridged</name>
<uuid>ff5f8075-31a7-4cc9-21bf-5c8d144f58f0</uuid>
<forward mode='bridge'/>
<bridge name='br-ex' />
<virtualport type='openvswitch'/>
<portgroup name='untagged' default='yes'>
</portgroup>
</network>
@scottslowe
scottslowe / lxc-template
Created November 25, 2013 19:59
This snippet of libvirt XML can be used as a template when creating LXC containers that you want to run/manage via libvirt.
<domain type='lxc'>
<name>REPLACE</name>
<memory>327680</memory>
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>