Using Puppet with launchd¶
Apple Computer has made it clear that the future of application and server launching is their new launchd. Whether or not you have an affinity for launchd, it appears to be here to stay, replacing SysV Init as well as the newer StartupItems. The configuration of each server is done with (surprise) XML property lists.
If you would like to run puppetd with launchd, you’ll need to put the folowing content into /Library/LaunchDaemons/com.reductivelabs.puppet.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/sbin:/usr/sbin:/bin:/usr/bin</string>
<key>RUBYLIB</key>
<string>/usr/lib/ruby/site_ruby/1.8/</string>
</dict>
<key>Label</key>
<string>com.reductivelabs.puppet</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/puppetd</string>
<string>--verbose</string>
<string>--no-daemonize</string>
<string>--logdest</string>
<string>console</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Puppet Daemon</string>
<key>ServiceIPC</key>
<false/>
<key>StandardErrorPath</key>
<string>/var/puppet/log/puppet.err</string>
<key>StandardOutPath</key>
<string>/var/puppet/log/puppet.out</string>
</dict>
</plist>
If you would like to run puppetmasterd with launchd, you’ll need to put the folowing content into `` /Library/LaunchDaemons/com.reductivelabs.puppetmaster.plist``:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/sbin:/usr/sbin:/bin:/usr/bin</string>
<key>RUBYLIB</key>
<string>/usr/lib/ruby/site_ruby/1.8/</string>
</dict>
<key>Label</key>
<string>com.reductivelabs.puppetmaster</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/puppetmasterd</string>
<string>--verbose</string>
<string>--no-daemonize</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Puppetmaster Daemon</string>
<key>ServiceIPC</key>
<false/>
<key>StandardErrorPath</key>
<string>/var/puppet/log/puppetmaster.err</string>
<key>StandardOutPath</key>
<string>/var/puppet/log/puppetmaster.out</string>
</dict>
</plist>
Now use the launchctl program to make launchd aware of the new services (the -w makes launchd permanently aware of the new daemon):
% launchctl load -w /Library/LaunchDaemons/com.reductivelabs.puppet.plist
% launchctl load -w /Library/LaunchDaemons/com.reductivelabs.puppetmaster.plist
As with all launchd plist files, owner and group of the file wants to be root:wheel, and permissions want to be 644 (owner has read/write, group and other read-only) The services should now launch at boot-time.