Skip to content

Instantly share code, notes, and snippets.

View glarizza's full-sized avatar

Gary Larizza glarizza

  • Open Infrastructure Services
  • Portland, Oregon
View GitHub Profile
@glarizza
glarizza / gist:1449029
Created December 8, 2011 22:40
puppet dashboard face commands
puppet dashboard list --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet classes --render-as=yaml
puppet dashboard create_group --name=demo1 --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet --render-as=yaml
puppet dashboard create_node --name=demo1 --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet --render-as=yaml
puppet dashboard create_class --name=demo1 --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet --render-as=yaml
puppet dashboard create_node --name=demo2 --classes=pe_mcollective,pe_accounts --groups=default --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet --render-as=yaml
puppet dashboard create_group --name=demo3 --classes=stupidity,stupid2 --parent-groups=default --enc-server=sony --enc-ssl --enc-port=443 --enc-auth-user=console --enc-auth-passwd=puppet --render-as=yaml --trace
puppet dashbo
@glarizza
glarizza / gist:1561644
Created January 4, 2012 19:34
Setting Password
This method gets an already-prepared password string fed as the variable 'password_hash'
@@users_plist_dir = '/var/db/dslocal/nodes/Default/users'
if File.exists?("#{@@users_plist_dir}/#{resource_name}.plist")
# If a plist already exists in /var/db/dslocal/nodes/Default/users, then
# we will need to extract the binary plist from the 'ShadowHashData'
# key, log the new password into the resultant plist's 'SALTED-SHA512'
# key, and then save the entire structure back.
users_plist = Plist::parse_xml(`plutil -convert xml1 -o /dev/stdout #{@@users_plist_dir}/#{resource_name}.plist`)
@glarizza
glarizza / gist:1575359
Created January 7, 2012 17:19
Testing plists w/ defaults read
The-Big-Mac:~ glarizza$ defaults read /Applications/TextEdit.app/Contents/Info NSServices
(
{
NSMenuItem = {
default = "New TextEdit Window Containing Selection";
};
NSMessage = openSelection;
NSPortName = TextEdit;
NSSendTypes = (
"com.apple.flat-rtfd",
@glarizza
glarizza / gist:1598939
Created January 12, 2012 05:25
Getting Users
users = %x{ps aux 2> /dev/null | grep [l]oginwindow | cut -d " " -f1}.split
puts (users - ['root']).join(",")
@glarizza
glarizza / gist:1602745
Created January 12, 2012 19:57
Mounting on OS X with Puppet
mount { "/mnt/mount_name_on_disk":
device => "//username:password@server/mountpoint",
fstype => smbfs,
ensure => mounted,
options => 'nostreams',
}
@glarizza
glarizza / gist:1614020
Created January 15, 2012 02:43
Launching an instance in EC2 with Cloud Provisioner
## Launching an instance in EC2
└(~)▷ irb
>> require 'puppet/face'
=> true
>> arguments = { 'image' => 'ami-1bd68a5e', 'keyname' => 'gary_test', 'type' => 't1.micro', 'region' => 'us-west-1' }
=> {"region"=>"us-west-1", "keyname"=>"gary_test", "type"=>"t1.micro", "image"=>"ami-1bd68a5e"}
>> ec2_ip = Puppet::Face[:node_aws, :current].create(arguments)
#######################
=> "ec2-184-72-21-49.us-west-1.compute.amazonaws.com"
@glarizza
glarizza / gist:1718567
Created February 1, 2012 18:40
Nasty Inheritance
class separate {
file { '/tmp/foo':
ensure => file,
content => 'First Level',
}
}
class different inherits separate {
File['/tmp/foo'] {
content => 'different',
@glarizza
glarizza / gist:1719086
Created February 1, 2012 20:22
Include Order
## This works
class separate($foo = 'bar') {
file { '/tmp/foo':
ensure => file,
content => 'First Level',
}
}
class different inherits separate {
@glarizza
glarizza / gist:1752700
Created February 6, 2012 15:36
crankd supports:
Plugin:IPConfiguration
Plugin:InterfaceNamer
Setup:
Setup:/
Setup:/Network/BackToMyMac
Setup:/Network/Global/IPv4
Setup:/Network/HostNames
Setup:/Network/Interface/en1/AirPort
Setup:/System
State:/IOKit/PowerManagement/Assertions
This program is distributed "as is" by JAMF Software, LLC. For more information or support for the Redistribution and use in source and binary forms, with or without modification, are permitted provi* Redistributions of source code must retain the above copyright notice, this list of conditions and* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribut* Neither the name of the JAMF Software, LLC nor the names of its contributors may be used to endorsTHIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVIC