Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / defined-virtual-users
Created November 10, 2012 01:44
Puppet defined type for creating virtual user resources
# Defined type for creating virtual user accounts
#
define accounts::virtual ($uid,$gid,$realname,$pass,$sshkey="") {
@user { $title:
ensure => 'present',
uid => $uid,
gid => $gid,
shell => '/bin/bash',
home => "/home/${title}",
@scottslowe
scottslowe / virtual-users-defined-type
Created November 10, 2012 06:46
Final (simplified) defined type for creating virtual user acounts
# Defined type for creating virtual user accounts
#
define accounts::virtual ($uid,$realname,$pass) {
user { $title:
ensure => 'present',
uid => $uid,
gid => $title,
shell => '/bin/bash',
home => "/home/${title}",
@scottslowe
scottslowe / sample-virtual-user
Created November 10, 2012 06:51
Sample user definition using virtual user resource
# Used to define/realize users on Puppet-managed systems
#
class accounts {
@accounts::virtual { 'johndoe':
uid => 1001,
realname => 'John Doe',
pass => '<password hash goes here>',
}
}
@scottslowe
scottslowe / realize-virtual-user
Created November 10, 2012 06:55
Realize a virtual user resource in a node definition
node default {
}
node 'server.domain.net' {
include accounts
realize (Accounts::Virtual['johndoe'])
}
@scottslowe
scottslowe / libvirt-xml-ovs
Created November 12, 2012 05:37
Network XML definition for libvirt-OVS integration
<network>
<name>ovs-network</name>
<forward mode='bridge'/>
<bridge name='ovsbr0'/>
<virtualport type='openvswitch'/>
<portgroup name='vlan-01' default='yes'>
</portgroup>
<portgroup name='vlan-02'>
<vlan>
<tag id='2'/>
@scottslowe
scottslowe / domain-libvirt-xml-ovs
Created November 12, 2012 06:09
Domain XML definition for libvirt-OVS integration
<interface type='network'>
<mac address='11:22:33:44:55:66'/>
<source network='ovs-network' portgroup='vlan-02'/>
</interface>
@scottslowe
scottslowe / ntp-example-manifest
Created November 25, 2012 05:09
Simple file-package-service Puppet manifest
file { "ntp.conf" :
path => "/etc/ntp.conf",
owner => "root",
group => "root",
mode => 644,
source => "puppet:///modules/ntp/ntp.conf",
}
package { "ntp":
ensure => installed,
@scottslowe
scottslowe / ntp-sample-multi-os-manifest
Created November 25, 2012 05:11
Simplistic multi-OS Puppet manifest
file { "ntp.conf":
path => $operatingsystem ? {
"OpenBSD" => "/etc/ntpd.conf",
default => "/etc/ntp.conf",
},
owner => "root",
group => $operatingsystem ? {
"OpenBSD" => "wheel",
default => "root",
},
@scottslowe
scottslowe / ntp-sample-common-file-resource
Created November 25, 2012 05:13
Sample file resource in ntp::common
file { "ntp.conf":
path => "/etc/ntp.conf",
owner => "root",
group => "root",
mode => 644,
source => "puppet:///modules/ntp/ntp.conf",
}
@scottslowe
scottslowe / sample-ntp-subclass-file-override
Created November 25, 2012 05:14
Subclass file resource overriding parent file resource definition
File["ntp.conf"] {
path => "/etc/ntpd.conf",
group => "wheel",
source => "puppet:///modules/ntp/ntpd.conf.openbsd",
}