15

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.

Joel Westberg
  • 201
  • 2
  • 5
  • What version of puppet are you running? Are you trying the above manifests with `puppet apply manifest.pp`? – chutz Dec 10 '12 at 23:59
  • The debug does not seems to contain any 'actual' error. Can you check in /private/var/log/system.log if there are any related entries? – John Siu Dec 11 '12 at 18:36
  • @chutz: Running `sudo puppet apply manifest.pp` on Puppet 3.0.1, Facter 1.6.16 @JohnSiu: Nothing there either, sadly. – Joel Westberg Dec 11 '12 at 22:18
  • I don't think your are going wrong in any way. However , I think you must check the programming approach once again. – Toby Apr 25 '13 at 05:20
  • You wrote > But RabbitMQ doesn't start either (as it does if I do a manual load with launchctl) This indicates the plist may not be correctly configured, so please post the entire plist – Erik Cayré Jan 15 '14 at 23:17
  • Do you know if puppet is loading the launchd plist? If not, you'll need to wait til reboot, or force a launchctl load plist step after install. Make sure the plist has the run on load flag set in it. Can you post the plist and output of launchctl list with the service name. – Alex Jul 21 '13 at 06:42

3 Answers3

1

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

ssgelm
  • 161
  • 1
  • 5
0

A sort of brute force approach:

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

node fancymac { include "rabbitmqosx }
Stephan
  • 999
  • 7
  • 11
0

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.