Search code examples
homebrewpuppetosx-yosemiteunzip

Facing difficulty in installing unzip tool in Mac OS X using puppet script


We are in the process of writing a puppet manifest which will install unzip and some other tools in Mac OS X, the puppet manifest looks like below.

$packages = ['lsof','unzip','sysstat','telnet', 'git', 'less', 'tree', 'zip']

package {
    $packages:
        ensure => installed,
        provider  => 'brew',
}

but when i run this it gives an error as below,

Error: Failed to apply catalog: Parameter provider failed on Package[lsof]: Invalid package provider 'brew' at /home/rajeevan/appfactory/modules/wso2base/manifests/packages.pp:9
Wrapped exception:
Invalid package provider 'brew'
Wrapped exception:
Invalid package provider 'brew'

Then we executed the command

brew install unzip

just to ensure the unzip tool is getting installed, but it doesn't.

I have googled it and found a solution

$ brew tap homebrew/dupes
$ brew install unzip

This works nicely, but as far as puppet concerned, How to do this in my puppet manifest?


Solution

  • A quick google search of my own indicated that if you use the boxen-homebrew module, you can write a manifest like this:

    homebrew::tap { 'homebrew/dupes': }
    ->
    package {
        $packages:
            ensure => installed,
            provider  => 'homebrew',
    }
    

    Failing that, you could fall back to the exec type.

    exec { 'brew tap homebrew/dupes': ... }
    ->
    package {
       ...
    }
    

    But it is up to you then to declare fitting queries for the exec to determine when it needs running, or whether it is in sync already.