Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / create-ovs-patch-port
Created November 27, 2012 18:42
Commands to create an OVS patch port
ovs-vsctl add-port <bridge name> <port name>
ovs-vsctl set interface <port name> type=patch
ovs-vsctl set interface <port name> options:peer=<peer name>
@scottslowe
scottslowe / ovs-patch-port-configuration
Created November 27, 2012 18:46
OVS configuration with bridges connected via patch ports
Bridge "ovsbr2"
Port "ovsbr2"
Interface "ovsbr2"
type: internal
Port "patch2-0"
Interface "patch2-0"
type: patch
options: {peer="patch0-2"}
Bridge "ovsbr0"
Port "bond0"
@scottslowe
scottslowe / accounts-config-subclass
Created December 13, 2012 04:22
Simplified snippet from accounts::config to manage files in /etc/skel
class accounts::config {
# Place a file in /etc/profile.d to manage the prompt
file { '/etc/profile.d/prompt.sh':
ensure => 'present',
source => 'puppet:///modules/config/profiled-prompt.sh',
mode => '0644',
owner => '0',
group => '0',
}
@scottslowe
scottslowe / fictional-puppet-class
Last active December 11, 2015 21:48
Entirely fictional Puppet code to show dependencies on single resources
class foo {
package { 'foo':
ensure => 'present',
}
file { '/etc/foo.conf':
ensure => 'present',
source => 'puppet:///modules/foo/foo_conf',
mode => '0600',
require => Package['foo'],
@scottslowe
scottslowe / virtual-user-dependency
Created January 29, 2013 14:51
This Puppet code defines a virtual user resource, but includes a subclass dependency to ensure certain files are present before the account is defined.
# Used to define virtual users on Puppet-managed systems
# Includes subclass dependency on accounts::config
#
class accounts {
@accounts::virtual { 'johndoe':
uid => 1001,
realname => 'John Doe',
pass => '<password hash goes here>',
require => Class['accounts::config'],
@scottslowe
scottslowe / ifcfg-ovsbr0-script
Created February 7, 2013 20:13
This is an example of a RHEL/RHEL-variant network startup script that will automatically create an OVS bridge.
DEVICE="ovsbr0"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSBridge"
BOOTPROTO="none"
HOTPLUG="no"
@scottslowe
scottslowe / ifcfg-bond0-script
Created February 7, 2013 20:17
This RHEL/RHEL variant network startup script creates a LACP bond on an OVS bridge.
DEVICE="bond0"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSBond"
OVS_BRIDGE="ovsbr0"
BOOTPROTO="none"
BOND_IFACES="eth0 eth1"
OVS_OPTIONS="bond_mode=balance-tcp lacp=active"
HOTPLUG="no"
@scottslowe
scottslowe / ifcfg-mgmt0-script
Created February 7, 2013 20:20
This RHEL/RHEL variant network startup script creates an OVS internal interface and assigns it an IP address.
DEVICE="mgmt0"
BOOTPROTO="static"
ONBOOT="yes"
DEVICETYPE="ovs"
TYPE="OVSIntPort"
IPADDR=10.11.12.13
NETMASK=255.255.255.0
OVS_BRIDGE="ovsbr0"
HOTPLUG="no"
@scottslowe
scottslowe / rhel-integrated-ovs-config
Created February 7, 2013 20:25
This snippet of output from ovs-vsctl shows an OVS configuration after corresponding RHEL/RHEL variant network startup scripts have been evaluated.
542de17b-4eb5-4eff-f736-3c760e40dff3
Bridge "ovsbr0"
Port "mgmt0"
Interface "mgmt0"
type: internal
Port "ovsbr0"
Interface "ovsbr0"
type: internal
Port "bond0"
Interface "eth0"
@scottslowe
scottslowe / modify-virt-user-collection
Last active December 12, 2015 07:59
This snippet of Puppet code shows how to modify the group membership of a realized virtual user resource
User <| title == 'johndoe' |> {
groups => 'othergroup',
}