Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Get started with the JBoss Web Server collection

October 16, 2024
Harsha Cherukuri
Related topics:
Automation and managementJava
Related products:
Red Hat Ansible Automation PlatformRed Hat JBoss Web Server

Share:

    The article A tutorial on Middleware Automation Collections discussed using the ansible-galaxy tool to install Ansible Content Collections on a control node. It also guides you in using the ansible-navigator utility and Ansible Execution Environments to perform automation tasks. Finally, an overview of the ansible-middleware-ee execution environment from the Ansible Middleware project is provided. It describes how this EE  includes all of the Ansible Content Collections and their dependencies.

    In this tutorial, we will leverage the ansible-middleware-ee Execution Environment as the basis for carrying out automation activities. Let's get started using the JBoss Web Server collection, provided by the Ansible Middleware team, which can help automate the management of Red Hat JBoss Web Server.

    Step 1: Use the ansible-navigator utility

    Let’s use the execution environment and the ansible-navigator utility to automate and provision the JBoss Web Server collection. The ansible-middleware-ee Execution Environment contains all the latest upstream collections within the image, so no additional actions are needed. To browse the set of collections included in the image, run the following command:

    $ ansible-navigator --eei quay.io/ansible-middleware/ansible-middleware-ee:latest collections
        Name                       Version Shadowed Type     Path
        0│ansible.builtin            2.15.3  False    contained /usr/local/lib/python3.9/si
        1│ansible.netcommon          5.1.2   False    contained /usr/share/ansible/collecti
        2│ansible.posix              1.5.4   False    contained /usr/share/ansible/collecti
        3│ansible.utils              2.10.3  False    contained /usr/share/ansible/collecti
        4│community.general          7.3.0   False    contained /usr/share/ansible/collecti
        5│middleware_automation.amq  1.3.8   False    contained /usr/share/ansible/collecti
        6│middleware_automation.amq_s0.0.5   False    contained /usr/share/ansible/collecti
        7│middleware_automation.commo1.1.2   False    contained /usr/share/ansible/collecti
        8│middleware_automation.infin1.2.0   False    contained /usr/share/ansible/collecti
        9│middleware_automation.jws  1.2.3   False    contained /usr/share/ansible/collecti
    	10│middleware_automation.keycl1.2.8   False    contained /usr/share/ansible/collecti
    	11│middleware_automation.redha1.2.2   False    contained /usr/share/ansible/collecti
    	12│middleware_automation.wildf1.3.4   False    contained /usr/share/ansible/collecti

    Step 2: Set up the inventory

    Let's now set up an instance of the JBoss Web Server. Create an inventory file that includes a Red Hat Enterprise Linux 8 machine, the IP address of the instance, and the associated login information that Ansible can use. For this demonstration, SSH keys are being used instead of passwords. These SSH keys need to be available on the control node and the location of the private key is referenced in the inventory file. The inventory file look should look similar to the following:

    [jws]
                jws-0 ansible_host=10.0.0.1 ansible_user=root ansible_ssh_private_key_file=”path to your private key”

    Step 3: Set up the vars.yml file

    On the Ansible control node, create a vars.yml file which will contain variables to customize the execution of the Ansible automation. To specify the JBoss Web Server version to install, set the jws_version variable. For example, set jws_version to 5.7.0 to install that specific version of the server. By default, the collection installs the latest patch update. You can set jws_apply_patchs to true and specify the jws_patch_version with the specific version of the patch to install. We can set the jws_java_version variable to set the appropriate JDK version. For example, we can set the variable to 1.8.0 or 11 or 17. The collection also configures a systemd service by specifying jws_systemd_enabled as true. Once configured, the vars.yml file appears similar to the following:

    ---
    jws_setup: true
    jws_java_version: 17
    jws_listen_http_bind_address: 127.0.0.1
    jws_systemd_enabled: True
    jws_service_systemd_type: forking
    jws_selinux_enabled: False

    Step 4: Install and configure the JBoss Web Server

    Create a file called jws.yml containing a playbook to install and configure the JBoss Web Server on the target hosts. In addition, it will also deploy a web application to demonstrate the functionality of the web server. See below:

    ---
    - name: "Red Hat JBoss Web Server installation and configuration"
        hosts: all
        become: True
        vars_files:
        - vars.yml
        roles:
        - redhat.jws.jws
        tasks:
        - name: "Deploy webapp"
            ansible.builtin.get_url:
            url: "https://drive.google.com/uc?export=download&id=1w9ss5okctnjUvRAxhPEPyC7DmbUwmbhb"
            dest: "{{ jws_home }}/webapps/info.war"

    Step 5: Run the Ansible Playbook

    With all of the prerequisite and configuration steps complete, run the Ansible Playbook using ansible-navigator and the execution environment to configure the JBoss Web Server on the remote hosts:

    $ ansible-navigator --eei quay.io/ansible-middleware/ansible-middleware-ee:latest run jws.yml -i inventory -m stdout --become

    Once the JWS service is deployed, start an SSH to the instance to check the status of the systemd service:

    ssh root@10.0.0.1 systemctl status jws.service

    We can also check if the port is accessible or not using the following command:

    # curl -I http://localhost:9990/health

    Alternatively, we can perform validation checks using the validation role from the collection. To do so, create a new file called validation.yml with the following content.

    ---
    - name: "Red Hat JBoss Web Server validation"
        hosts: all
        become: true
        vars_files:
        - vars.yml
        roles:
        - middleware_automation.jws.jws_validation

    Now, invoke the validation playbook using ansible-navigator:

    $ ansible-navigator --eei quay.io/ansible-middleware/ansible-middleware-ee:latest run validation.yml -i inventory -m stdout --become

    In this tutorial, we have demonstrated how to use the Ansible middleware execution environment and set up JBoss Web Server using the Ansible Content Collections for JBoss Web Server. We can also deploy JBoss Web Server using the certified JBoss Web Server collection on the Ansible Automation Hub. You can check out the other collections and demos within the GitHub organization: ansible-middleware and the Middleware Automation Collections website.

    Last updated: November 13, 2024

    Related Posts

    • Automate JBoss Web Server deployment with the Red Hat Certified Content Collection for JWS

    • Automate JBoss Web Server 6 deployment with the Red Hat Ansible Certified Content Collection for JWS

    • Set up mod_cluster for Red Hat JBoss Web Server with Ansible

    • Set up mod_cluster for Red Hat JBoss Web Server with Ansible

    Recent Posts

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    What’s up next?

    Get an introduction to Server Connector for IntelliJ. This learning path helps you deploy applications to multiple application servers via Tomcat, JBoss Enterprise Application Platform (JBoss EAP), and Wildfly using the IntelliJ IDE extension.

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue