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
#!/usr/bin/env ruby
users = []
users += %x(ps aux 2> /dev/null | grep loginwindow | cut -d " " -f1).split()
puts (users - ['root']).join(",")
bash-3.2# pwd
/Users/glarizza/Desktop
bash-3.2# echo $RUBYLIB
/Users/glarizza/lib/ruby/
bash-3.2# cat ~/lib/ruby/facter/testuser.rb
require 'facter'
require 'osx/cocoa'
boe:Desktop glarizza$ facter
/Library/Ruby/Site/1.8/facter/util/plist/generator.rb:9: Plist is not a module (TypeError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Site/1.8/facter/util/plist.rb:17
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Site/1.8/facter/util/macosx.rb:21
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
##Shell Output
boe:~ glarizza$ irb
>> require 'mcollective'
=> true
>> MCollective.version
=> "1.0.0"
>>
boe:~ glarizza$ sudo /usr/sbin/mc-facts uptime
Password:

So, I generally don't see Munki and Puppet as occupying the same space. Munki is package management - it excels at installing and removing packages from your Macs in a way that is most harmonious to your users. It will present a nice GUI window that looks identical to Software Update (so it's very familiar) and allow the user to choose when their updates are installed. You CAN force updates upon users, but Munki's allure is its graceful system-installation set. If you want Munki to manage any other aspects of your computer, then you need to package it up. Wanna make a change? Create a package. At its core it's essentially something similar to Yum or Apt in the Linux world, no? In the same way you can "yum install firefox" you can add Firefox to a Munki manifest and push it to the user.

Puppet is CONFIGURATION MANAGEMENT - so it is focused on an ideal state for your computer. Maybe you want to ensure that this service is always running, or that these config files are ALWAYS identical. Perhaps you ne

Our Initial Question:

Q. What is the equivalent of a "Kickstart" (or preseed) file in OS X? What file can you create with OS X that would customize an OS X Install AT, or before, Install-time?

  • My initial thought was the InstallerChoices.xml file - but as far as I'm aware that file isn't 'read' by the OS X Installer during Installation - it has to be submitted as an argument.

Greg responded to me with the below:

"Yes, I suppose the ChoiceChangesXML file (of whatever name) is the closest analogue of the Kickstart file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleSoftwareUpdatesOnly</key>
<false/>
<key>ClientIdentifier</key>
<string>testing</string>
<key>InstallAppleSoftwareUpdates</key>
<false/>
#!/usr/bin/env python
# munkicli <action> packagename repoURL <args>
#
# Actions: install, uninstall, status
# Args: --version,
#
# Process - accept the package name, query the manifest for package info (package id plist),
# check if installed (and version), install/update/uninstall package or list status.
import os
import subprocess
larizza-garyclass-boe:mcollective-demo glarizza$ vagrant up
[a] Provisioning enabled with puppet...
[a] Importing base box 'lenny64'...
[a] Matching MAC address for NAT networking...
[a] Running any VM customizations...
[a] Clearing any previously set forwarded ports...
[a] Forwarding ports...
[a] -- ssh: 22 => 2222 (adapter 1)
[a] Creating shared folders metadata...
[a] Preparing host only network...
2011-04-11 05:00:08,523 | INFO | PListStore:activemq-data/localhost/tmp_storage started | org.apache.activemq.store.kahadb.plist.PListStore | WrapperSimpleAppMain
2011-04-11 05:00:08,757 | INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[activemq-data/localhost/KahaDB] | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2011-04-11 05:00:12,562 | ERROR | Failed to start ActiveMQ JMS Message Broker. Reason: java.io.EOFException: Chunk stream does not exist at page: 0 | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
java.io.EOFException: Chunk stream does not exist at page: 0
at org.apache.kahadb.page.Transaction$2.readPage(Transaction.java:454)
at org.apache.kahadb.page.Transaction$2.<init>(Transaction.java:431)
at org.apache.kahadb.page.Transaction.openInputStream(Transaction.java:428)
at org.apache.kahadb.page.Transaction.load(Transaction.java:404)
at org.apache.kahadb.page.Transaction.load(Transaction.java:361)
at org.apache.activemq.store.kahadb.MessageDataba