Installing glassfish with puppet

There are two major problems with installing glassfish through puppet in default configuration of puppetmaster:

* The jar file of glassfish is too big
* You have to accept sun lisense during the installation

The cause of first problem is that by default puppetmasterd uses WEBRICK as it web-server. It would be probably not a problem if it was not using at the same time xmlrpc calls. The consequence of such configuration is that big files timeouts to be transfered. The workaround I found to solve this is to use apache (or any other webserver) to serve files, and, instead of using File default definition, use Exec that executes curl, that fetches file from puppet server.

Second problem is also well-known from installation of sun JDK, so I just extend this solution, that people can find by googling “puppet install java”: the main idea is to provide answers to the accept license questions. The code for acceptance looks approx like below:

file { “/opt/accept.txt”:
content => “An”
}
exec { “/usr/lib/jvm/java-6-openjdk/bin/java -Xmx256m -Djava.io.tmpdir=/opt/tmp_dir -jar glassfish-installer-v2.1.1-b31g-linux.jar < accept.txt":
path => “/usr/bin:/usr/lib/jvm/java-6-openjdk/bin:/usr/lib/jvm/java-6-openjdk”,
cwd => “/opt”,
creates => “/opt/glassfish”,
require => [File[“/opt/accept.txt”], Package[“openjdk-6-jre”], File[“/opt/glassfish-installer-v2.1.1-b31g-linux.jar”], File[“/opt/tmp_dir”]]
}