mandag 13. september 2010

Managing GlassFish domains with Puppet

Following James Turnbull's plugin HOWTO, I've created a new Puppet resource type for managing GlassFish domains. You can get it via the Puppet Forge.

This plugin is meant to replace the previously used (with success) exec type for managing GlassFish domains:
$passfile = "/home/gfish/.aspass"
$portbase = "4900"
$asadmin = "/opt/NSBglassfish/bin/asadmin"
$domaindir = "/opt/NSBglassfish/glassfish/domains"

exec {
command => "$asadmin --user admin --passwordfile $passfile create-domain --profile cluster --portbase $portbase --savelogin $name",
user => "admin",
creates => "$domaindir/$name";

his new resource type allows for more functionality and expressive clarity than the exec type. For example, it allows you to easily delete the domain by using the ensure => absent property. This is how one specifies a new GlassFish domain with this:
glassfish {
portbase => "4800",
adminuser => "admin",
passwordfile => "/home/gfish/.aspass",
profile => "cluster",
ensure => present;

ensure => absent;

I plan to add more features to it, such as adding system-properties and jvm-options.