Deploy JBoss Enterprise Application Platform (EAP) using Ansible Automation Platform (AAP) [Part 2]

June Han
5 min readAug 22, 2023

--

Following up on the Part 1 of the series here, this article will cover Ansible Automation Platform Configuration to run the Project written in Part 1 of this series.

JBoss EAP Server will be deployed across 2 servers. An application will be deployed on each server using Ansible Automation Platform.

Log into the AAP Controller on the VM through a browser, it will have a similar interface as shown below:

Controller Interface

Creating Inventory

Under the Resources, there is another tab known as Inventories. Click on the Inventories tab and press on the blue add button to add new inventories.

Adding a new inventory

I have named it as a JBoss_Inventory. Set the organisation to default and save the inventory as is.

Go back to the inventories and click on the JBoss_Inventory. Under the access tab, check if there is a root user. Create one if there is none.

User name would be root and User type would be System Administrator.

Creating a root user (if necessary)

Creating Hosts

Under the resources tab, there is a Hosts tab. Add the hosts to be utilised under this section.

Creating Hosts on AAP

Under the JSON section for host creation:

{
"ansible_host": "192.123.124.2",
"ansible_user": "root",
"ansible_ssh_pass": "password"
}

The credentials are specified here for ease of use, these credentials can be added under the Credentials tab under Resources.

Creating Server Groups

Under the JBoss_Inventory, there is Groups tab, create server group. The server group name would be appservers.

Creating Server Groups

When creating the server group, write in the JSON section:

{
"ansible_connection": "ssh"
}

After creating the Server group, add the hosts into the server group. Click on the appservers Server group and under Hosts tab, add Host.

Click on add existing host and click on eap1 and eap2.

Adding Hosts to the Server Group

Now your inventory is set, time to create a project.

Creating a Project

There are 2 methods to import in the project from part 1:

  1. Utilizing Git repository
  2. Moving the project folder to the base project path.

Creating a Project with Git

  • Under Projects tab, add new project, write a name. Mine is JBoss_OnPrem
  • Select Default Execution Environment for execution environment and Git as the source control type
  • This will lead to a drop down to add in the GitHub details. Type in the GitHub link under Source Control URL and click on Update Revision on Launch, to ensure that AAP pulls the latest version of the project from Git whenever the job is ran.
  • Save the Project.
Creating a new project from Git

Creating a Project with Local Project Folder

  • Under Projects tab, add new project.
  • Select Default Execution Environment for execution environment and Git as the source control type
  • Keep the Source Control Type as Manual.
  • There will be default Project Base Path that comes with AAP, which is /var/lib/projects
  • Select the directory from the Playbook Directory drop down.
Creating a new project from the local directory
  • Move the project folder to the Project Base Path:
mv /JBoss_EAP_Deploy /var/lib/awx/projects
  • Change the ownership and group of the Project files.
sudo chown -R awx:awx /JBoss_EAP_Deploy

Note:

If there are any errors for access during Job Run, change the permissions of the folder (Quick Fix, as permissions may depend on your needs, try to debug the permissions needed)

sudo chown -R 755 /JBoss_EAP_Deploy
  • Save the project and next would be to create Job Templates under the Project Directory for launching.

Creating a Job Template

  • Enter the Projects Tab under Resources
  • Click the project created from the previous section (JBoss Onprem).
  • There will be Job Templates tab, create a new Job Template.
Creating a new Job Template
  • Name the Job Template, and set the Job Type to Run
  • Set the Inventory to JBoss_Inventory (Created in the sections above)
  • Set the Project to JBoss_OnPrem (Created in the sections above)
  • Execution Environment can be set as default.
  • The playbook will be automatically detected from the project folder, which is site.yml.
Job Template Privilege Escalation
  • Select on Privilege Escalation
Created a new Job Template
  • Click on the JBoss_Onprem_Servers and launch the template. OR you can click on the little rocket icon of the right side of the Job Template.
  • Give the Job a few minutes to run.

Checking Application Deployed

Now go into the EAP Virtual Machine. The info.war file will be hosted on 0.0.0.0:8080/info

Java Application Hosted

Checking JBoss EAP Server Status

Using Command Prompt

Run the command:

systemctl status jboss-eap-rhel
systemctl status

The status will be active (running).

Using browser

In the browser type localhost:8080, it will show the JBoss EAP Status as running.

Deploying Multiple Java Applications (Manually)

The EAP Server (as admin) can be accessed on localhost:9990, the password and username are those specified in the playbook in the previous section.

JBoss EAP Server

On each server, multiple java applications can be deployed.

Multiple WAR projects deployed

Pressing on the context root will lead you to the web page where the Java Web Application has been deployed.

Second Java Application Deployed

That’s it for deploying JBoss EAP and Java Web Application on the JBoss EAP server using Ansible! Hope it has been informative and I have not missed anything out!

--

--

June Han

Just a curious, adventurous techie that's sharing her learning journeys