Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / ovs-br-int
Created August 22, 2013 14:20
This is the output of "ovs-vsctl show" before integration with NVP, just to verify the presence of the integration bridge.
7e99f9f1-8ec7-48dd-8463-0e04dd5efc11
Bridge br-int
fail_mode: secure
Port br-int
Interface br-int
type: internal
ovs_version: "1.10.1.24190"
@scottslowe
scottslowe / br-int-settings
Created August 22, 2013 14:24
This output of "ovs-vsctl list bridge br-int" allows you to verify that the integration bridge has been configured appropriately for NVP.
_uuid : 5ae0d3ab-49b1-4734-988b-70e04f95124d
controller : []
datapath_id : "0000aad3e05a3447"
datapath_type : ""
external_ids : {bridge-id=br-int}
fail_mode : secure
flood_vlans : []
flow_tables : {}
mirrors : []
name : br-int
@scottslowe
scottslowe / nvp-ovs-with-tunnels
Created August 22, 2013 18:08
This output of "ovs-vsctl show," taken from a hypervisor that is part of NVP and has guest domains running that are attached to a logical network, shows the tunnels created automatically by NVP.
7e99f9f1-8ec7-48dd-8463-0e04dd5efc11
Manager "ssl:192.168.1.5:6632"
is_connected: true
Manager "ssl:192.168.1.6:6632"
is_connected: true
Manager "ssl:192.168.1.2:6632"
is_connected: true
Bridge br-int
Controller "unix:ovs-l3d.mgmt"
is_connected: true
@scottslowe
scottslowe / ovs-vsctl-list-interface
Created September 4, 2013 14:25
This output from "ovs-vsctl list interface vnet0" shows how to match an OVS interface to a specific VM using the MAC address stored in the external_ids value.
_uuid : d3613f46-4ef8-4e4c-99f6-55676394a32a
admin_state : up
cfm_fault : []
cfm_fault_status : []
cfm_health : []
cfm_mpid : []
cfm_remote_mpids : []
cfm_remote_opstate : []
duplex : full
external_ids : {attached-mac="52:54:00:B5:AE:29", iface-id="d198ac1a-c93e-af49-a0f0-ad78a5b19a56", iface-status=active, vm-id="c0e9b909-7233-d2eb-7fde-3a2d39db1ae5"}
@scottslowe
scottslowe / apt-source-ubuntu-cloud
Created October 4, 2013 14:51
This snippet of Puppet code, designed for use with the Puppet Labs apt module, configures an Ubuntu system to use the Ubuntu Cloud Archive.
apt::source { 'ubuntu-cloud':
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
repos => 'main',
release => 'precise-updates/grizzly',
include_src => false,
required_packages => 'ubuntu-cloud-keyring',
}
@scottslowe
scottslowe / puppet-apt-proxy-config
Created October 10, 2013 20:06
This snippet of Puppet code (which relies upon the Puppet Labs Apt module) will configure apt to use a local Apt proxy (in this example, a local instance of Apt-Cacher-NG).
# Configure apt to use apt-cacher-ng
class {'apt':
proxy_host => 'apt-cacher-ng.example.com',
proxy_port => '3142',
}
@scottslowe
scottslowe / ubuntu-1204-server-preseed
Created October 10, 2013 20:50
This preseed file automates the installation of Ubuntu Server 12.04. Replace the values bracketed by less than/greater than symbols with values specific to your own environment.
# Ubuntu Server automated installation
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/choose_interface select eth0
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i mirror/country string manual
@scottslowe
scottslowe / puppet-ovs-packages
Created October 11, 2013 17:04
This portion of Puppet code installs Open vSwitch (OVS) packages from an internal repository, along with prerequisite packages.
if $::operatingsystem == 'Ubuntu' {
# Install prerequisite packages
package {'make':
ensure => 'installed',
}
package {'dkms':
ensure => 'installed',
}
@scottslowe
scottslowe / defined-virt-user-ssh-key
Created October 20, 2013 03:38
This Puppet code uses define-based virtual user resources to help manage user account on systems. This includes user's SSH keys as well as other properties.
define accounts::virtual ($uid,$realname,$pass,$sshkeytype,$sshkey) {
include accounts::params
# Pull in values from accounts::params
$homepath = $accounts::params::homepath
$shell = $accounts::params::shell
# Create the user
user { $title:
ensure => 'present',
@scottslowe
scottslowe / virt-user-with-ssh-key
Created October 21, 2013 17:44
When used in conjunction with an appropriate define-based virtual resource (see gist named "defined-virt-user-ssh-key"), this will define a user including their public SSH key.
@accounts::virtual { 'jsmith':
uid => 5001,
realname => 'John Smith',
pass => '<insert password hash here>',
sshkeytype => 'ssh-dss',
sshkey => '<insert SSH key here>',
require => Class['accounts::config'],
}