木偶和启动服务?

我们有一个使用Puppetconfiguration的生产环境,并且希望能够在我们的开发机器上build立一个类似的环境:Red Hats,Ubuntus和OSX。 正如所料,OSX在这里是个奇怪的人,可惜的是,我在这个工作上遇到很多麻烦。

我第一次尝试使用macports ,使用以下声明:

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

但是,可悲的是,这产生了以下错误:

 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" 

接下来,我想我会尝试一下homebrew 。 没有包供应商默认情况下,但木偶自制似乎很有前途。 在这里,我得到了更多,实际上设法安装工作。

 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"] ], } 

在这里,我没有得到任何错误。 但是RabbitMQ不会启动(就像我使用launchctl手动加载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 

我究竟做错了什么?

编辑 :为了logging,我们现在使用Vagrant虚拟机,而不是我们的OSX机器,但本地解决scheme仍然是首选。

    不幸的是,configurationpipe理工具对台式机来说并不是很好。 使用像Vagrant这样的工具要好得多(如你所见 )。

    Vagrant是一个开源的虚拟化软件,允许你通过pipe理程序复制环境。 在我的Mac上,我使用它的Oracle VirtualBox(主要是厨师testing)。 VirtualBox也是免费的。 Vagrant最初的意图是让开发人员有一个一致的环境来工作(即:你在找什么,但不是你想如何工作)。 stream浪者可以和Puppet结合,看看这些例子 。

    一种暴力方式:

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

    不知道这是否仍然是一个问题,但看起来这是3.1.0中修复launchd提供程序的错误。 错误: https : //projects.puppetlabs.com/issues/16271