Ansible Collection Architecture
Relevant source files
The following files were used as context for generating this wiki page:
The spm_middleware collection is a structured distribution format for Ansible content specifically designed to automate the installation and configuration of middleware required for Cúram Social Program Management (SPM). It packages roles, modules, and plugins into a single unit to enable reuse and standardized deployment across internal test and development environments.
Sources: README.md:3-8, galaxy.yml:8-11
Collection Structure and Metadata
The architecture follows the standard Ansible collection layout. The root directory contains the galaxy.yml file, which defines the namespace (merative), the collection name (spm_middleware), and its version. This metadata is essential for packaging and publishing the collection to Ansible Galaxy.
Directory Layout
The following diagram illustrates the logical organization of the collection components:
The collection organizes automation logic into distinct directories for plugins, roles, and administrative scripts.
Sources: README.md:23-42, galaxy.yml:4-20
Middleware Roles and Components
The collection provides specialized roles for various middleware components. Each role follows a consistent pattern: managing prerequisites, copying or downloading installers, performing base installations, and applying patches or fixpacks.
| Role Name | Description | Supported Platforms |
|---|---|---|
websphere | Installs WebSphere Application Server ND | EL 7, 8 |
liberty | Installs WebSphere Liberty | EL 7, 8 |
db2 | Installs and Configures IBM Db2 server | EL 7, 8 |
iim | Installs IBM Installation Manager | EL, MacOSX, Ubuntu, Windows |
ohs | Installs/Patches Oracle HTTP Server | EL 7, 8, 9 |
oracle | Installs/Configures Oracle Database | EL 7, 8 |
Sources: roles/websphere/meta/main.yml:3-28, roles/liberty/meta/main.yml:3-28, roles/db2/meta/main.yml:3-28, roles/iim/meta/main.yml:3-36
Installation Logic and Data Flow
The collection utilizes a common pattern for installing heavy middleware. It supports two main modes: downloading installers from a remote URL (e.g., Artifactory) or copying them from a local source path.
Installer Workflow
The following sequence diagram shows the typical task flow when installing a component like WebSphere or Db2:
This flow ensures that the target system is prepared, the software is retrieved, installed, and the workspace is cleaned up.
Sources: roles/websphere/tasks/v90_base_install.yml:2-80, roles/db2/tasks/install.yml:3-48
IBM Installation Manager Integration
For IBM products, the collection relies heavily on the iim_package module. This module interacts with IIMAgent to manage the lifecycle of packages.
# Example usage of iim_package in websphere role
- name: Install WAS
iim_package:
iim_path: "{{ iim_install_path }}"
product_id:
- "{{ websphere_base_pid }}"
- "{{ websphere_java_pid }}"
path: "{{ websphere_install_path }}"
repo: "{{ repo_list }}"
state: present
Sources: roles/websphere/tasks/v90_base_install.yml:64-73, plugins/modules/iim_package.py:85-115
Development and Testing Architecture
The collection includes a robust testing framework based on Molecule. This allows developers to verify roles against various scenarios, such as different operating systems (e.g., Rocky Linux 8) or middleware versions.
Testing Prerequisites and Environment
- Molecule: Used for testing roles via
molecule test -s <scenario>. - Dev Containers: VS Code configuration for a standardized local development environment.
- Environment Variables: Configuration for Artifactory integration (
ARTIFACTORY_URL,ARTIFACTORY_TOKEN).
Sources: README.md:46-65, CONTRIBUTING.md:1-40
Build and Release Pipeline
A dedicated script, tagAndPublish.sh, manages the release process by creating Git tags, building the collection archive (.tar.gz), and publishing it to Ansible Galaxy.
# Core logic of the release process
ansible-galaxy collection build -c
ansible-galaxy collection publish -c -vvv "./$COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz"
Sources: scripts/tagAndPublish.sh:1-13, galaxy.yml:40-47
Summary
The spm_middleware collection architecture is designed for the complex requirements of IBM SPM middleware. By abstracting installation logic into reusable roles and custom modules like iim_package, it provides a consistent interface for managing various database (Db2, Oracle) and application server (WebSphere, Liberty, OHS) technologies. The inclusion of a Molecule-based testing suite and containerized development environments ensures high-quality automation suitable for internal development lifecycles.