Puppet and launchd services?

We have a production environment configured with Puppet, and want to be able to set up a similar environment on our development machines: a mix of Red Hats, Ubuntus and OSX. As might be expected, OSX is the odd man out here, and sadly, I'm having a lot of trouble with getting this to work.

My first attempt was using macports, using the following declaration:

package { 'rabbitmq-server':     ensure   => installed,     provider => macports, } 

but this, sadly, generates the following error:

Error: /Stage[main]/Rabbitmq/Package[rabbitmq-server]: Could not evaluate: Execution of '/opt/local/bin/port -q installed rabbitmq-server' returned 1: usage: cut -b list [-n] [file ...]        cut -c list [file ...]        cut -f list [-s] [-d delim] [file ...]     while executing "exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2"     (procedure "mportinit" line 95)     invoked from within "mportinit ui_options global_options global_variations" 

Next up, I figured I'd give homebrew a try. There is no package provider available by default, but puppet-homebrew seemed promising. Here, I got much farther, and actually managed to get the install to work.

package { 'rabbitmq':     ensure   => installed,     provider => brew, } file { "plist":     path   => "/Library/LaunchDaemons/homebrew.mxcl.rabbitmq.plist",     source => "/usr/local/opt/rabbitmq/homebrew.mxcl.rabbitmq.plist",     ensure => present,     owner  => root,     group  => wheel,     mode   => 0644, } service { "homebrew.mxcl.rabbitmq":     enable      => true,     ensure      => running,     provider    => "launchd",     require     => [ File["/Library/LaunchDaemons/homebrew.mxcl.rabbitmq.plist"] ], } 

Here, I don't get any error. But RabbitMQ doesn't start either (as it does if I do a manual load with launchctl)

     [... snip ...]     Debug: Executing '/bin/launchctl list'     Debug: Executing '/usr/bin/plutil -convert xml1 -o /dev/stdout         /Library/LaunchDaemons/homebrew.mxcl.rabbitmq.plist'     Debug: Executing '/usr/bin/plutil -convert xml1 -o /dev/stdout         /var/db/launchd.db/com.apple.launchd/overrides.plist'     Debug: /Schedule[weekly]: Skipping device resources because running on a host     Debug: /Schedule[puppet]: Skipping device resources because running on a host     Debug: Finishing transaction 2248294820     Debug: Storing state     Debug: Stored state in 0.01 seconds     Finished catalog run in 25.90 seconds 

What am I doing wrong?

Edit: For the record, we're now doing this with Vagrant VMs instead on our OSX machines, but the native solution would still be preferred.


Unfortunately, configuration management tools don't really work well for desktop machines. It is much better to use a tool like Vagrant (as you have).

Vagrant is an open-source virtualization software that allows you to replicate environments via hypervisors. On my Mac, I use it with Oracle's VirtualBox (mostly for Chef testing). VirtualBox is also free. The original intent of Vagrant was to allow developers to have consistent environments to work in (ie: what you were looking for but not how you wanted it to work). Vagrant can be combined with Puppet, check out these examples.

A sort of brute force approach:

class rabbitmqosx {
    exec { "rabbitmqosx":
           command =>  "/path/to/rabbitmq",
           unless => [
                       "/bin/ps |grep -c rabbitmq"

node fancymac { include "rabbitmqosx }

Not sure if this is still an issue but it looks like this was a bug with the launchd provider fixed in 3.1.0. Bug: https://projects.puppetlabs.com/issues/16271

Category: mac osx Time: 2012-12-06 Views: 1
Tags: mac osx puppet

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.171 (s). 12 q(s)