Module Utilities: IIM Python Utilities
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The IIM Python Utilities provide a centralized abstraction layer for interacting with the IBM Installation Manager (IIM) within the SPM Middleware collection. These utilities are primarily encapsulated in the IIMAgent class, which facilitates the management of IBM software packages, including installation, uninstallation, and version verification.
This module is a critical component for roles that deploy middleware such as IBM HTTP Server (IHS), WebSphere Application Server (WAS), and WebSphere Liberty. It allows Ansible modules to execute complex IIM commands through a standardized Python interface, ensuring consistent package management across the Social Program Management (SPM) infrastructure.
Sources: plugins/modules/iim_package.py:1-50, plugins/module_utils/iim.py
Architecture and Core Components
The architecture relies on a shared utility class, IIMAgent, which is imported by specific Ansible modules to perform operations. The modules iim_package and iim_info serve as the primary entry points for Ansible tasks.
Interaction Flow
The following diagram illustrates how Ansible tasks interact with the IIM utilities to manage packages.
The IIMAgent class handles the construction of command-line arguments for the imcl binary, which is the underlying engine for IBM Installation Manager.
Sources: plugins/modules/iim_package.py:91-100, plugins/modules/iim_info.py:65-75
Key Functions and Methods
The IIMAgent class provides several methods to query and modify the state of IBM software.
Package Querying
The utility allows modules to check for both "base" versions and "exact" versions (including FixPacks) of a product. This is essential for idempotency in Ansible.
list_installed_packages(): Retrieves a list of all packages currently managed by IIM.have_base_version(product_id): Checks if the core product family is installed.have_exact_version(product_id): Validates if a specific version string (e.g., including FixPack suffixes) is present.
Sources: plugins/modules/iim_info.py:79-81, plugins/modules/iim_package.py:108-112
Package Management
These methods execute the actual changes on the system:
| Method | Purpose | Key Parameters |
|---|---|---|
install_package | Installs or updates a list of product IDs. | product_id, repo, path, properties, preferences |
uninstall_package | Removes specified packages from the system. | product_id |
Sources: plugins/modules/iim_package.py:107-115, plugins/modules/iim_package.py:20-45
Usage in Middleware Roles
The IIM utilities are extensively used across various middleware roles to ensure the correct version of software is present before configuration.
Deployment Logic Sequence
The following sequence diagram shows the typical lifecycle of a middleware installation task using the IIM utilities.
Role Integration Examples
- IHS Installation: The
ihsrole usesiim_packageto install the IBM HTTP Server, Plugin (PLG), and Toolbox (WCT) by passing repository lists and specific product IDs. - WebSphere Liberty: The
libertyrole checks for the base version usingiim_infoand subsequently triggersfixpack_install.ymlif the exact version is missing.- Sources: roles/liberty/tasks/main.yml:8-15
- WebSphere Application Server: The
websphererole builds a repository list dynamically and passes it to theiim_packagemodule to install both the WAS base and the Java SDK in a single operation.
Configuration and Options
The IIM utilities support a variety of configuration options passed through the Ansible module arguments.
| Option | Type | Default | Description |
|---|---|---|---|
iim_path | path | /opt/IBM/InstallationManager | The location of the IIM binary directory. |
shared_resources | path | /opt/IBM/IMShared | The directory where IIM stores shared components. |
product_id | list | Required | The ID(s) of the product(s) to manage (e.g., com.ibm.websphere.IHS.v90). |
repos | list | N/A | List of repository paths or URLs containing the installation files. |
properties | dict | N/A | Key-value pairs for installation properties (e.g., user.ihs.httpPort). |
Sources: plugins/modules/iim_package.py:10-40, plugins/modules/iim_info.py:12-25
Conclusion
The Module Utilities for IIM provide a robust abstraction that hides the complexity of IBM Installation Manager command-line operations. By providing a consistent interface for package verification and deployment, it enables the SPM Middleware collection to manage complex software stacks like WebSphere and IHS with high reliability and idempotency.