Puppet and launchd services?

Posted by Joel Westberg on Server Fault See other posts from Server Fault or by Joel Westberg
Published on 2012-12-06T20:23:52Z Indexed on 2012/12/08 23:09 UTC
Read the original article Hit count: 263

Filed under:
|

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?

© Server Fault or respective owner

Related posts about macosx

Related posts about puppet