Custom Module: iim_info
Relevant source files
The following files were used as context for generating this wiki page:
The iim_info module is a specialized Ansible module within the spm_middleware collection designed to query and retrieve information regarding packages installed via the IBM Installation Manager (IIM). It serves as a diagnostic and state-checking tool, allowing playbooks to verify the presence of specific product families or exact version instances before proceeding with installation or upgrade tasks.
Within the broader project architecture, iim_info is frequently utilized by middleware roles such as ihs, liberty, and websphere to implement conditional logic. By registering the output of this module, roles can determine if a base installation is required or if a specific FixPack needs to be applied.
Sources: plugins/modules/iim_info.py:8-14, roles/ihs/tasks/main.yml:6-10
Module Functionality and Logic
The module functions by interfacing with the IIMAgent utility. It accepts an optional product_id and an iim_path. Its primary logic involves listing all installed packages and, if a product_id is provided, determining if that specific package or its base version exists in the current environment.
Data Flow Execution
The following diagram illustrates the internal logic flow of the iim_info module during execution:
The module always returns a list of all packages. If a product_id is supplied, it additionally populates boolean indicators for base_installed and exact_installed.
Sources: plugins/modules/iim_info.py:53-73
Configuration Parameters
The module supports the following input parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
iim_path | path | No | /opt/IBM/InstallationManager | Absolute path to the IBM Installation Manager installation. |
product_id | list | No | None | A list containing the product family or specific product ID (including FixPack details) to check. |
Sources: plugins/modules/iim_info.py:15-24, plugins/modules/iim_info.py:55-58
Return Values
The module returns the following information, which is typically captured using the Ansible register keyword:
| Key | Type | Returned | Description |
|---|---|---|---|
packages | list | always | A list of all strings representing installed packages. |
base_installed | boolean | when product_id provided | Indicates if the base product/family is installed. |
exact_installed | boolean | when product_id supported | Indicates if the specific version/FixPack version is installed. |
Sources: plugins/modules/iim_info.py:38-51, plugins/modules/iim_info.py:68-71
Practical Integration in Roles
iim_info is critical for idempotency in the middleware installation roles. It is used to gate installation tasks to prevent redundant executions.
Example: IHS Role Integration
In the ihs role, iim_info checks for the presence of the Plugin (PLG) component.
- name: Check packages
iim_info:
iim_path: "{{ iim_install_path }}"
product_id: "com.ibm.websphere.PLG.{{ ihs_pid }}"
register: iim_info
- name: Install Base version
include_tasks: "{{ ihs_pid.split('_') | first }}_base_install.yml"
when: not iim_info.base_installed
Sources: roles/ihs/tasks/main.yml:6-14
Role Usage Comparison
Different roles use the module to check specific Product IDs:
| Role | Target Product ID Check | File Path |
|---|---|---|
| IHS | com.ibm.websphere.PLG.{{ ihs_pid }} | roles/ihs/tasks/main.yml |
| Liberty | com.ibm.websphere.liberty.ND_{{ liberty_pid }} | roles/liberty/tasks/main.yml |
| WebSphere | com.ibm.websphere.ND.{{ websphere_pid }} | roles/websphere/tasks/main.yml |
Sources: roles/ihs/tasks/main.yml:6-10, roles/liberty/tasks/main.yml:6-10, roles/websphere/tasks/main.yml:6-10
Comparison with iim_package
While iim_info is strictly for information gathering, the related iim_package module performs the actual state changes (installation/uninstallation). Both modules share the IIMAgent utility class and similar parameter structures for iim_path and product_id.
Summary
The iim_info module is a fundamental component for state discovery within the spm_middleware collection. By providing granular details about base and exact versions of IBM products, it enables complex middleware orchestration while maintaining the idempotency required for automated environment provisioning.