As part of my work I need to be able to test different Java Web applications. I need to be able to run some tests on more then only single computer, hence I need rapid way of setting up several Linux based computers/servers with configured Java running, usually I’m using Ubuntu based destributives.
Therefore I’ve choose the winning couple of Puppet and Vagrant. You’re more than welcome to read about these tools and I’ll skip the installation guide for them, since google has pleanty of different tutorials explaning how to do it for different platform, so you just need to pick the right one for you.
I’m going to show how to leverage Puppet modules architecture, how to implement new module which will be capable to install and configure Java for new VM machine. To learn more about modules in Puppet, please take a look on modules fundamentals article on Puppet labs site.
1. Download Java.
Very first step which has to be done, is to download tar gz archive of Java JDK or (JRE), from Oracle official site. By the time I’m writting this post current lates JDK tar gz is jdk-7u40-linux-i586.tar.gz.
PS. Thanks to my friend which pointed me to more nice and clear way of declaring variable in a class in a way it could be customized later with values different from defaults. I’ve update the post and here you can see the customization example: