Skip to content

Instantly share code, notes, and snippets.

@tommeier
Last active October 18, 2019 18:07
Show Gist options
  • Save tommeier/5288796 to your computer and use it in GitHub Desktop.
Save tommeier/5288796 to your computer and use it in GitHub Desktop.
Boxen puppet file to load my local box
class people::tommeier {
require ruby
include chrome
include firefox
include iterm2::dev
include sublime_text_2
include caffeine
include onepassword
include dropbox
include things
include skype
include vlc
include virtualbox
include postgresql
$ruby_version = "1.9.3"
$home = "/Users/${::luser}"
$src_dir = $::boxen_srcdir
$user_bin_dir = "${home}/bin"
$code_current_dir = "${src_dir}/current"
$code_company_dir = "${src_dir}/company"
$code_family_dir = "${src_dir}/family"
$code_archived_dir = "${src_dir}/archived"
$code_personal_dir = "${src_dir}/personal"
$ferocia_directory = "${code_company_dir}/ferocia"
$private_dotfiles = "${code_personal_dir}/private-dotfiles"
$dotfiles = "${code_personal_dir}/dotfiles"
file { [ $user_bin_dir,
$code_current_dir, $code_company_dir, $code_family_dir,
$code_archived_dir, $code_personal_dir,
$ferocia_directory ]:
ensure => "directory"
}
#'chromedriver'
#'rbenv
#'ruby-build'
package {
[
'curl',
'coreutils',
'elasticsearch',
'git',
'heroku-toolbelt',
'node',
'redis',
'roundup',
'tree'
]:
}
# Set default ruby.
class { 'ruby::global':
version => "${ruby_version}"
}
# Install git-pulls gem.
ruby::gem { "git-pulls for ${ruby_version}":
gem => 'git-pulls',
ruby => $ruby_version
}
repository { $private_dotfiles:
source => 'tommeier/private-dotfiles',
require => File[$code_personal_dir]
}
repository { $dotfiles:
source => 'tommeier/dotfiles',
require => File[$code_personal_dir]
}
exec { "install-updated-private-dotfiles":
cwd => $private_dotfiles,
command => "git checkout master && git pull && rake install REPLACE_ALL=true",
require => Repository[$private_dotfiles]
}
exec { "install-updated-dotfiles":
cwd => $dotfiles,
command => "git checkout master && git pull && rake install REPLACE_ALL=true",
require => Repository[$dotfiles]
}
#Load Ferocia projects into custom directory
class {'projects::johanna': custom_dir => $ferocia_directory }
class {'projects::documents': custom_dir => $ferocia_directory }
class {'projects::fake-web-seal': custom_dir => $ferocia_directory }
class {'projects::integration': custom_dir => $ferocia_directory }
package { 'iStumbler':
provider => 'compressed_app',
source => "http://istumbler.net/downloads/istumbler-99.zip"
}
package { 'NetNewsWire':
provider => 'compressed_app',
source => "http://netnewswireapp.com/downloads/NetNewsWire.zip"
}
package { 'PS3 Media Server':
provider => 'appdmg',
source => "https://ps3mediaserver.googlecode.com/files/pms-macosx-1.72.0.dmg"
}
package { 'Transmission Remote GUI':
provider => 'pkgdmg',
source => "https://transmisson-remote-gui.googlecode.com/files/transgui-4.1.dmg",
ensure => 'installed',
}
package { 'iStatMenus4':
provider => 'compressed_app',
source => "http://s3.amazonaws.com/bjango/files/istatmenus4/istatmenus4.04.zip",
}
#Install fonts
exec { 'Font: Inconsolata':
command => "curl -L http://www.levien.com/type/myfonts/Inconsolata.otf -o /Users/${::luser}/Library/Fonts/Inconsolata.otf",
creates => "/Users/${::luser}/Library/Fonts/Inconsolata.otf"
}
#Load apple services
exec { 'Locate':
command => 'launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist'
}
#Symlink bin files
exec { 'Sublime Text 2 Bin file':
command => "ln -s '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' ${user_bin_dir}/subl",
creates => "${user_bin_dir}/subl",
}
#Custom classes to be extracted later
class automaticsubscriptions {
$pref_pane_dir = "/Users/${::luser}/Library/PreferencePanes"
$pref_pane_name = "Automatic.prefPane"
$tmp_install_dir = "/opt/boxen/cache"
$tmp_zip = "automatic.zip"
$download_package = "http://codingcurious.com/downloads/Automatic.2.zip"
exec { 'automatic-download':
cwd => $tmp_install_dir,
command => "curl -L ${download_package} -o ${tmp_zip} && unzip -o ${tmp_zip}",
creates => "${tmp_install_dir}/${pref_pane_name}",
require => [ Package["curl"] ]
}
exec { 'automatic-install':
command => "cp -R ${tmp_install_dir}/${pref_pane_name} ${pref_pane_dir}/",
creates => "${pref_pane_dir}/${pref_pane_name}",
require => Exec["automatic-download"]
}
Exec["automatic-install"] -> notify { 'Automatic Loaded': }
}
include automaticsubscriptions
# Additional configuration for .gitconfig
git::config::global { 'user.email':
value => '[email protected]',
}
git::config::global { 'github.user':
value => "tommeier",
}
#Generate Github ssh key if not present
exec {'Generate SSH key for Github':
command => "ssh-keygen -t rsa -C '[email protected]' -f /Users/${::luser}/.ssh/id_rsa -N 'SomePassphraseNaughtyPerson'",
unless => "test -e /Users/${::luser}/.ssh/id_rsa"
}
#Copy public key to Github : cat ~/.ssh/id_rsa.pub
#export PATH=$PATH:/opt/boxen/homebrew/share/npm/bin #Globally loaded NPM modules
#Temporary fix - Booleans require different read to write value
#See : https://github.com/boxen/puppet-boxen/pull/19 for fix required
# : Used same interface as osx_defaults for an easy revert later
# : When pull request is in, just remove all ::boolean references
define boxen::osx_defaults::boolean(
$ensure = 'present',
$domain = undef,
$key = undef,
$value = undef,
$user = undef,
$type = undef,
) {
$defaults_cmd = '/usr/bin/defaults'
if $ensure == 'present' {
if ($domain != undef) and ($key != undef) and ($value != undef) {
if ($type != undef) {
$cmd = "${defaults_cmd} write ${domain} ${key} -${type} '${value}'"
} else {
$cmd = "${defaults_cmd} write ${domain} ${key} '${value}'"
}
if ($type =~ /^bool/) {
$checkvalue = $value ? {
/(true|yes)/ => '1',
/(false|no)/ => '0',
}
} else {
$checkvalue = $value
}
exec { "osx_defaults write ${domain}:${key}=>${value}":
command => "${cmd}",
unless => "${defaults_cmd} read ${domain} ${key} && (${defaults_cmd} read ${domain} ${key} | awk '{ exit \$0 != \"${checkvalue}\" }')",
user => $user
}
} else {
warning('Cannot ensure present without domain, key, and value attributes')
}
} else {
warning('You should have set ensure, this is just a fake temoporary class yo!')
}
}
#Defaults just for tommeier user
# -> Remove the boolean conditional when pull merged in (should just be a wrapper)
define boxen::osx_defaults::tommeier(
$ensure = 'present',
$domain = undef,
$key = undef,
$value = undef,
$type = undef,
$user = $::luser,
) {
if ($type =~ /^bool/) {
warning('Still using temporary boolean monkey patch. Check https://github.com/boxen/puppet-boxen/pull/19')
#hack in boolean conditionals
boxen::osx_defaults::boolean {$title:
ensure => $ensure,
domain => $domain,
key => $key,
type => $type,
value => $value,
user => $user
}
} else {
boxen::osx_defaults {$title:
ensure => $ensure,
domain => $domain,
key => $key,
type => $type,
value => $value,
user => $user
}
}
}
#OSX Defaults
#Global OSX Preferences
boxen::osx_defaults::tommeier { 'Disable press and hold character loading':
domain => 'NSGlobalDomain',
key => 'ApplePressAndHoldEnabled',
type => boolean,
value => false
}
boxen::osx_defaults::tommeier { 'Disable dashboard':
domain => 'com.apple.dashboard',
key => 'mcx-disabled',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Always show scrollbars':
domain => 'NSGlobalDomain',
key => 'AppleShowScrollBars',
value => 'Always'
}
boxen::osx_defaults::tommeier { 'Expand print panel by default':
key => 'PMPrintingExpandedStateForPrint',
domain => 'NSGlobalDomain',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Avoid creating .DS_Store files on network volumes':
key => 'DSDontWriteNetworkStores',
domain => 'com.apple.desktopservices',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Disable reopen windows when logging back in':
key => 'TALLogoutSavesState',
domain => 'com.apple.loginwindow',
type => boolean,
value => false
}
boxen::osx_defaults::tommeier { 'Secure Empty Trash':
key => 'EmptyTrashSecurely',
domain => 'com.apple.finder',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Disable the "Are you sure you want to open this application?" dialog':
key => 'LSQuarantine',
domain => 'com.apple.LaunchServices',
type => boolean,
value => true
}
# Dock
boxen::osx_defaults::tommeier { 'Enable magnficiation':
domain => 'com.apple.dock',
key => 'magnification',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Dock tilesize":
domain => 'com.apple.dock',
key => 'tilesize',
type => integer,
value => 40
}
boxen::osx_defaults::tommeier { 'Set magnification icon size':
domain => 'com.apple.dock',
key => 'largesize',
type => 'float',
value => 61.00
}
boxen::osx_defaults::tommeier { 'Show indicator lights':
domain => 'com.apple.dock',
key => 'show-process-indicators',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Dashboard as overlay":
domain => 'com.apple.dock',
key => 'dashboard-in-overlay',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Autohide dock":
domain => 'com.apple.dock',
key => 'autohide',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Dock autohiden delay':
domain => 'com.apple.dock',
key => 'autohide-delay',
type => float,
value => 0
}
# Finder
boxen::osx_defaults::tommeier { 'Finder - show all save extensions':
domain => 'NSGlobalDomain',
key => 'AppleShowAllExtensions',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Finder - expand save by default':
domain => 'NSGlobalDomain',
key => 'NSNavPanelExpandedStateForSaveMode',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { 'Disable change filename extension warning':
domain => 'com.apple.finder',
key => 'FXEnableExtensionChangeWarning',
type => boolean,
value => false
}
boxen::osx_defaults::tommeier { 'Use current dir as searchscope':
domain => 'com.apple.finder',
key => 'FXDefaultSearchScope',
value => 'SCcf'
}
boxen::osx_defaults::tommeier { 'show hidden files':
domain => 'com.apple.finder',
key => 'AppleShowAllFiles',
type => boolean,
value => false
}
boxen::osx_defaults::tommeier { 'Display Finder status bar':
domain => 'com.apple.finder',
key => 'ShowStatusBar',
type => boolean,
value => true
}
# Trackpad Configuration
boxen::osx_defaults::tommeier { 'Disable tap to click':
domain => 'NSGlobalDomain',
key => 'com.apple.mouse.tapBehavior',
type => integer,
value => 0
}
boxen::osx_defaults::tommeier { 'Enable "natural" style scrolling':
domain => 'NSGlobalDomain',
key => 'com.apple.swipescrolldirection',
type => boolean,
value => true
}# -> Requires login/logout
## Keyboard
boxen::osx_defaults::tommeier { 'Enable full keyboard access for all controls - tab everything':
domain => 'NSGlobalDomain',
key => 'AppleKeyboardUIMode',
type => integer,
value => 3
}
boxen::osx_defaults::tommeier { 'Set a fast keyboard repeat rate':
domain => 'NSGlobalDomain',
key => 'KeyRepeat',
type => integer,
value => 2
}
boxen::osx_defaults::tommeier { 'initial key repeat':
domain => 'NSGlobalDomain',
key => 'InitialKeyRepeat',
type => integer,
value => 35
}
boxen::osx_defaults::tommeier { 'press and hold':
domain => '-g',
key => 'ApplePressAndHoldEnabled',
type => boolean,
value => false
}
#TODO : com.apple.Desktop (Background Dictionary to autoset Desktoppr background)
# Address Book
#TODO : Dictionary types
#ABInitialLabelsURLs -> Item0 (string) -> '_$!<HomePage>!$_'
#ABInitialLabelsPhone -> Item0 (string) -> '_$!<Mobile>!$_'
boxen::osx_defaults::tommeier { "Australia default country code":
domain => 'com.apple.AddressBook',
key => 'ABDefaultAddressCountryCode',
value => 'au'
}
boxen::osx_defaults::tommeier { "Display birthdays":
domain => 'com.apple.AddressBook',
key => 'ABBirthDayVisible',
type => integer,
value => 1
}
# iCal
boxen::osx_defaults::tommeier { "View in Aus timezone":
domain => 'com.apple.iCal',
key => 'lastViewsTimeZone',
value => 'Australia/Melbourne'
}
boxen::osx_defaults::tommeier { "Disable emphasized views":
domain => 'com.apple.iCal',
key => 'DisableEmphasizedViews',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "TimeZone support enabled":
domain => 'com.apple.iCal',
key => "'TimeZone support enabled'",
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Show time in Month View":
domain => 'com.apple.iCal',
key => "'Show time in Month View'",
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Show Week Numbers":
domain => 'com.apple.iCal',
key => "'Show Week Numbers'",
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "display birthdays calendar":
domain => 'com.apple.iCal',
key => "'display birthdays calendar'",
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Default calendar":
domain => 'com.apple.iCal',
key => 'CalDefaultCalendarSelectedByUser',
type => boolean,
value => false
}
#Automatic options : com.codingcurious.Automatic
boxen::osx_defaults::tommeier { "Registration name":
domain => 'com.codingcurious.Automatic',
key => 'registrationName',
value => 'Tom Meier'
}
boxen::osx_defaults::tommeier { "Valid license":
domain => 'com.codingcurious.Automatic',
key => 'licenseIsValid',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Ignore Propers":
domain => 'com.codingcurious.Automatic',
key => 'shouldIgnorePropers',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Sort subscriptions by name":
domain => 'com.codingcurious.Automatic',
key => 'sortSubscriptionsByName',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Display history":
domain => 'com.codingcurious.Automatic',
key => 'shouldDisplayHistory',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Enable automatic updates":
domain => 'com.codingcurious.Automatic',
key => 'SUEnableAutomaticChecks',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Download location":
domain => 'com.codingcurious.Automatic',
key => 'finalDownloadPath',
value => "/Users/${::luser}/Downloads"
}
boxen::osx_defaults::tommeier { "Open files automatically":
domain => 'com.codingcurious.Automatic',
key => 'shouldOpenFiles',
type => integer,
value => 1
}
boxen::osx_defaults::tommeier { "Refresh interval":
domain => 'com.codingcurious.Automatic',
key => 'refreshIntervalString',
value => '30 minutes'
}
boxen::osx_defaults::tommeier { "Disable magnets until it can handle file server downtime":
domain => 'com.codingcurious.Automatic',
key => 'disableMagnets',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Display TV status":
domain => 'com.codingcurious.Automatic',
key => 'shouldDisplayTVStatus',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Display HD":
domain => 'com.codingcurious.Automatic',
key => 'shouldDisplayHD',
type => boolean,
value => true
}
boxen::osx_defaults::tommeier { "Dont ask before deleting":
domain => 'com.codingcurious.Automatic',
key => 'dontAskForDelete',
type => boolean,
value => true
}
#Restart any available affected services
exec { 'restart-dock':
command => '/usr/bin/killall -HUP Dock',
refreshonly => true,
}
}
#TODO : Extract all tom's dev machine setup into seperate puppet repo
#TODO : Work out how to do 'dictionary' items in settings
#TODO :
#Clean install next steps :
# Open dropbox and load
# Load 1Password
# Open caffeine
# Set the user image (drag drop new image)
# Add new SSH key for Github (http://github.com)
# Copy keychain from old to new
# Run iCloud configuration settings (Settings > iCloud)
# Update Mail client, setup signature from the iCloud passed value, set Google imap accounts prefix to '[Gmail]'
# Add email accounts
# Add 1Password browser extensions to Chrome, Safari + Firefox
# Ensure iCal is setup for timeZones
# Open iMessage
# Open trillian
# Open chrome -> Sign in
# Reorder Finder folders to a better plan
# Change desktop settings to point to Desktoppr folder, random load, on login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment