Skip to main content

Handling NIM Actions Flow

In this document, we will explain the process of handling different NIM actions. The process involves initializing the Ansible module, defining parameters, retrieving these parameters, and calling the appropriate function based on the specified action.

The flow starts with initializing the Ansible module and defining the necessary parameters for various NIM actions. It then retrieves these parameters and logs the start of the NIM operation. Depending on the action specified by the user, it calls the appropriate function to handle that action, ensuring the correct NIM operation is performed.

Flow drill down


Handling Different NIM Actions

First, the main function initializes the Ansible module and defines the parameters required for various NIM actions. It then retrieves these parameters and logs the start of the NIM operation. Depending on the action specified, it calls the appropriate function to handle that action, such as nim_update, nim_maintenance, nim_master_setup, etc. This ensures that the correct NIM operation is performed based on the user's input.

def main():
global results

module = AnsibleModule(
argument_spec=dict(
action=dict(type='str', required=True,
choices=['update', 'master_setup', 'check', 'compare',
'script', 'allocate', 'deallocate',
'bos_inst', 'define_script', 'remove',
'reset', 'reboot', 'maintenance', 'show', 'register_client']),
lpp_source=dict(type='str'),
targets=dict(type='list', elements='str'),
new_targets=dict(type='list', elements='str'), # The elements format is <machine name>-<login id>-<password>
asynchronous=dict(type='bool', default=False),
device=dict(type='str'),
script=dict(type='str'),
resource=dict(type='str'),
location=dict(type='str'),
group=dict(type='str'),
force=dict(type='bool', default=False),
boot_client=dict(type='bool', default=True),


Updating NIM Clients

Next, the nim_update function is called when the action is 'update'. This function updates NIM clients with a specified lpp_source. It handles both synchronous and asynchronous updates, checks for interim fixes that could block the install, and ensures that the correct lpp_source is used for the update. It also logs detailed messages and updates the results dictionary with the status of the operation for each target.

def nim_update(module, params):
"""
Update nim clients (targets) with a specified lpp_source.

In case of updating to the latest TL or SP, the synchronous mode is forced.
Interim fixes that could block the install are removed.

arguments:
module (dict): The Ansible module
params (dict): The module parameters for the command.
note:
Exits with fail_json in case of error
"""

lpp_source = params['lpp_source']
alt_disk_update_name = params['alt_disk_update_name']
targets = params['targets']

async_update = 'no'
if params['asynchronous']:
async_update = 'yes'

 

This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human