Ansible Role: Oracle WebLogic
Relevant source files
The following files were used as context for generating this wiki page:
The weblogic role is a core component of the SPM Middleware collection, designed to automate the installation, configuration, and patching of Oracle WebLogic Server. It is specifically tailored for environments supporting Cúram Social Program Management and supports Enterprise Linux (EL) versions 7, 8, and 9.
The role follows a modular execution flow, handling system prerequisites, JDK installation, the base WebLogic installation, and subsequent patching via the Oracle OPatch tool. It ensures that the target environment meets specific internal requirements, such as maintaining specific older versions like 12.1.3.0.2 or specific JDK builds like 1.8.0_251 as required by development teams.
Sources: roles/weblogic/README.md:1-10, roles/weblogic/meta/main.yml:23-28, README.md:1-5
Role Architecture and Execution Flow
The role utilizes a standard Ansible structure where tasks/main.yml acts as the orchestrator. It dynamically includes variables based on the distribution major version and the specific WebLogic version requested.
Execution Logic
The following diagram illustrates the high-level logic flow of the role:
The role first checks for the existence of registry.xml to determine if installation is already complete. If not, it proceeds through prerequisites and installation. Patching is handled conditionally based on whether a patch is defined and if it is already present in the system inventory.
Sources: roles/weblogic/tasks/main.yml:5-30
Configuration and Variables
The role is highly configurable through variables, allowing users to define installation paths, ports, and version-specific artifacts.
| Property Name | Default Value | Description |
|---|---|---|
weblogic_base | /home/oracle | The base directory for the oracle installation. |
weblogic_home | /home/oracle/Oracle/Middleware/Oracle_Home | The specific ORACLE_HOME path. |
server_port | 7001 | The default administration port. |
weblogic_version | 14.1.1.0.240922 | The version to install (can be overridden). |
weblogic_user | oracle | The OS user that owns the installation. |
weblogic_group | oinstall | The primary OS group for the installation. |
Sources: roles/weblogic/README.md:12-32, roles/weblogic/tasks/prereqs.yml:19-27
System Prerequisites
The prereqs.yml task file prepares the Linux environment for Oracle software. This includes:
- Package Management: Installing required system libraries defined in
packages_list. - Kernel Tuning: Applying mandatory kernel parameters via
sysctl. - User Management: Creating the
oracleuser (UID 54321) and theoinstallgroup (GID 54321). - Resource Limits: Configuring soft and hard limits for open files (
nofile) and processes (nproc) in/etc/security/limits.conf. - JDK Setup: Downloading or copying the Java archive and extracting it to the designated
jdk_folder.
Installation and Patching
Base Installation
The installation is triggered if {{ weblogic_home }}/inventory/registry.xml is missing. The process typically involves using a response file to run the Oracle universal installer in silent mode.
Sources: roles/weblogic/tasks/main.yml:16-21
Patching with OPatch
The role handles patching by checking the output of the opatch lspatches command. If the specified patch_number is not found, it includes patch.yml. If a opatch_file variable is present in the version-specific variables, the role will also update the OPatch tool itself by running run_opatch.yml.
Sources: roles/weblogic/README.md:46-52, roles/weblogic/tasks/main.yml:23-30
Verification
Verification is performed via Molecule tests, which assert the state of the system after a playbook run. Key verification points include:
- Existence of
/opt/Props/AppServer.properties. - Correct environment variables in
/opt/profile.d/weblogic.sh(e.g.,MW_HOME). - Verification of the "installed" status in
registry.xml. - Validation of the OPatch version and applied patch IDs.
Sources: molecule/__weblogic-v12.2/verify.yml:10-40
Summary
The merative.spm_middleware.weblogic role provides a robust mechanism for deploying Oracle WebLogic Server. By integrating prerequisite handling, user management, JDK deployment, and OPatch-based patching, it ensures a consistent and compliant environment for SPM development and testing across various versions of Enterprise Linux.