Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

Puppet Module for JBOSS

3 min read

Recently one of my colleague called me up with a problem statement where he was finding difficulty configuring JBOSS through puppet. I tried to help him through one of VMware Workstation box on my Dell Inspiron.


I tried to google but couldn’t find the working example. I tried my hands of my own and YES…I did it finally.

I am sharing the overall idea how to deploy and configure JBOSS through Puppet.

Let’s say you have the following steps which you manually perform for installing JBOSS on your Linux machine:

1.$ su -c “yum install java-1.6.0-openjdk-devel”

2.$ java –version

3.wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip

4.$ unzip jboss-as-7.1.1.Final.zip -d /usr/share

5.$ adduser jboss

6.$ chown -fR jboss.jboss /usr/share/jboss-as-7.1.1.Final/

7.$ su jboss

8.$ cd /usr/share/jboss-as-7.1.1.Final/bin/

9.$ ./add-user.sh

You should see the following message on the console after executing the command:

What type of user do you wish to add?

a) Management User (mgmt-users.properties)

b) Application User (application-users.properties)

(a): a

We select “a”, next you should see the following message:

Enter the details of the new user to add.

Realm (ManagementRealm) :

Username : jboss

Password :

Re-enter Password :

* hit enter for Realm to use default, then provide a username and password

We select the default value for the Realm (ManagementRealm), by hitting enter, and select “jboss” as our username. By default, we supply “jb0ss” as our password, of course, you can provide any password you prefer here.

Step 4: Start the JBoss AS 7 server:

Once the appropriate JBoss users are created, we are now ready to start our new JBoss AS 7 server. With JBoss AS 7, a new standalone and domain model has been introduced. In this tutorial, we focus on starting up a standalone server. The domain server will be part of a future tutorial.

Startup a JBoss 7, standalone instance:

A standalone instance of JBoss 7 can be starting by executing:

$ ./standalone.sh -Djboss.bind.address= -Djboss.bind.address.management=0.0.0.

We can automate those steps for client through Puppet.Let’s start writing puppet init.pp from scratch. I will be delivering step by step of init.pp to achieve every components of init.pp.

Line 1 – 4

The Line 1 to 4 does nothing but downloading JBOSS to /usr/share directory. What we are going to do is put the downloaded jboss-as-7.1.1.Final on /var/lib/puppet/files directory on puppet master and push it to the puppet-client at /usr/share/jboss-as directory.

Here is the below init.pp

The above init.pp define a class jboss-custom, takes JBOSS-as-7.1.1-Final from the puppet-master /var/lib/puppet/files/ and push it to the puppet-client.

Que: How does it know which directory to pull the files from?

Answer: Under /etc/puppet/fileserver.conf, we define those path and permission as shown below:

Shall we start?

Ensure that you have put JBOSS-as-7.1.1-Final under /var/lib/puppet/files directory with permission:

#chown –R puppet:puppet /var/lib/puppet

The permission is very important and shouldn’t be skipped.

Now run the command from the puppet-client to check if it runs without any issue:

Wow !!! Our first program went well and the server has pushed the file to the puppet-client successfully.

Line:5 to 9

The easiest way of performing the overall step is writing a shell script which will run on the remote machine:

Go to /var/lib/puppet/files and create a script called jbossdeploy.sh


groupadd jbossas

useradd -g jbossas -p deQcvEr1PRPSM jbossas

chown -fR jbossas:jbossas /usr/share/jboss-as-7.1.1.Final/

cd /usr/share/jboss-as/


spawn ./add-user.sh

expect “(a):”

send “a”

expect “Realm (ManagementRealm):”

send “ManagementRealm”

expect “Username:”

send “jbossas”

expect “Password:”

send “jbossas”

expect “Re-enter Password:”

send “jbossas”

cd /usr/share/jboss-as-7.1.1.Final/bin

./standalone.sh -Djboss.bind.address= -Djboss.bind.address.management=

The above script will create jboss user and group, run add-user.sh command under /usr/share/jboss-as/jboss-as-7.1.1.Final/bin directory. I have used expect library (ensure it is already installed) in perl.

Lets modify the init.pp so as to accommodate this script execution as shown:

class jboss-custom {

file {‘/usr/share/jboss-as/jboss-7.1.1.Final’:

owner => ‘root’,

group => ‘root’,

mode => ‘0440’,

source => ‘puppet://puppet-server.test.com/files/jboss-as-7.1.1.Final’


file { ‘/usr/share/jboss-as/jbossdeploy.sh’:

source => ‘puppet://puppet-server.test.com/files/jbossdeploy.sh’


exec { “/usr/share/jboss-as/jbossdeploy.sh”:}


If you run now the following it goes all fine and start the JBOSS application server.

Lets test it.

puppet agent –test –verbose –server puppet-server.test.com

info: Caching catalog for puppet-client.test.com

info: Applying configuration version ‘1345944985’

notice: /File[/usr/share/jboss-as/jbossdeploy.sh]/content:

— /usr/share/jboss-as/jbossdeploy.sh 2012-08-29 17:37:01.365003616 -0400

+++ /tmp/puppet-file20120829-18751-81r0p8-0 2012-08-29 17:44:40.993732919 -0 400

@@ -1,12 +1,10 @@


groupadd jbossas

useradd -g jbossas -p deQcvEr1PRPSM jbossas

chown -fR jbossas:jbossas /usr/share/jboss-as-7.1.1.Final/

-cd /usr/share/jboss-as/jboss-as-7.1.1.Final/bin

+cd /usr/share/jboss-as/


-/usr/bin/expect << EOD

-spawn sh add-user.sh

+spawn ./add-user.sh

expect “(a):”

send “a”

expect “Realm (ManagementRealm):”

@@ -17,7 +15,6 @@

send “jbossas”

expect “Re-enter Password:”

send “jbossas”


cd /usr/share/jboss-as-7.1.1.Final/bin

./standalone.sh -Djboss.bind.address= -Djboss.bind.address.management=0. 0.0.0&

info: FileBucket adding {md5}afc9bd6b8229da628396b90f2759f41f

info: /File[/usr/share/jboss-as/jbossdeploy.sh]: Filebucketed /usr/share/jboss-a s/jbossdeploy.sh to puppet with sum afc9bd6b8229da628396b90f2759f41f

notice: /File[/usr/share/jboss-as/jbossdeploy.sh]/content: content changed ‘{md5 }afc9bd6b8229da628396b90f2759f41f’ to ‘{md5}140ab2a8605d1164793c2175aa972675’

notice: /Stage[main]/Jboss-custom/Exec[/usr/share/jboss-as/jbossdeploy.sh]/retur ns: executed successfully

notice: /File[/usr/share/jboss-as/jboss-7.1.1.Final]/ensure: created

notice: Finished catalog run in 0.79 seconds

[root@puppet-client ~]#

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

27 Replies to “Puppet Module for JBOSS”

  1. The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.

  2. Thanks for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more clear from this post. I’m very glad to see such magnificent information being shared freely out there.

  3. Hi there! Quick question that’s totally off topic. Do you know how to make your site mobile friendly? My blog looks weird when browsing from my iphone4. I’m trying to find a theme or plugin that might be able to resolve this issue. If you have any suggestions, please share. Appreciate it!

  4. I in addition to my friends have been reviewing the best ideas found on your website and then all of a sudden developed a terrible suspicion I never expressed respect to the site owner for them. My boys were as a result glad to see all of them and have actually been enjoying them. Thank you for turning out to be simply thoughtful and for going for varieties of terrific guides millions of individuals are really desperate to be informed on. My personal sincere regret for not saying thanks to you earlier.

  5. I do love the way you have framed this specific problem plus it does present us a lot of fodder for consideration. Nevertheless, because of everything that I have personally seen, I basically wish when the reviews pack on that people stay on issue and don’t embark upon a soap box of some other news du jour. Still, thank you for this outstanding piece and whilst I do not necessarily concur with this in totality, I respect your viewpoint.

  6. Youre so cool! I dont suppose Ive learn something like this before. So nice to find any individual with some original thoughts on this subject. realy thanks for starting this up. this website is one thing that’s needed on the internet, someone with a little bit originality. helpful job for bringing something new to the internet!

  7. Hi there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Internet explorer. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the problem fixed soon. Cheers

  8. Nice blog here! Also your site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

  9. excellent post, very informative. I wonder why the other specialists of this sector don’t notice this. You should continue your writing. I am sure, you’ve a huge readers’ base already!

  10. I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has inspired me to get my own blog now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.

  11. After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

  12. I am so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that is at the other blogs. Appreciate your sharing this greatest doc.

  13. Hey there! I’ve been reading your blog for some time now and finally got the courage to go ahead and give you a shout out from Austin Texas! Just wanted to mention keep up the excellent job!

  14. Most of the things you state happens to be supprisingly precise and that makes me wonder why I hadn’t looked at this in this light before. Your article really did turn the light on for me as far as this specific issue goes. Nonetheless there is actually just one factor I am not really too comfortable with so whilst I attempt to reconcile that with the main idea of your position, allow me observe exactly what all the rest of your readers have to point out.Very well done.

Leave a Reply

Your email address will not be published.