Grails Puppet module

November 13, 2012 at 15:31

This is an english version of the post I published in Mindfood in Spanish.

About the module

The next Puppet module I wanted to talk about is the Grails puppet module. Same as the other modules for Puppet, is published on OSOCO’s Github account, and is one of the most simple, but one of the most used in our infrastructures, for obvious reasons 😀 .

This module allows you to install multiple versions of Grails in a puppet node. The usage couldn’t be simpler, as you can see in the following code:

class jenkins {
    ...
    grails { "grails-1.3.5":
        version => '1.3.5',
        destination => '/opt'
    }

    grails { "grails-1.3.9":
        version => '1.3.9',
        destination => '/opt'
    }

    grails { "grails-2.0.0":
        version => '2.0.0',
        destination => '/opt'
    }

    grails { "grails-2.0.1":
        version => '2.0.1',
        destination => '/opt'
    }
    ...
}

In this example, a class jenkins declare multiple Grails installations (in order to launch the tests battery for each project with the proper Grails version) by adding various grails resources that is parametriced by the Grails version and the destination directory. The Grails module will resolve the download URL (that since 1.3.6 version must point to Amazon S3 instead of being self-hosted as in previous versions), and retrieve and unpack the ZIP only if necessary (i.e if the given Grails version is not already installed in the specified destination directory).

Dependencies

The module depends on OSOCO’s Puppet Wget module, so you should checkout both modules into your modules directory. Or, if you are using puppet-librarian, you can add the following to your Puppetfile file:

mod "wget",
   :git => "git://github.com/osoco/puppet-wget.git"
mod "grails",
   :git => "git://github.com/osoco/puppet-grails.git"