NIM Resource Overview
NIM Resource Overview
NIM Resource refers to various types of resources managed by the Network Installation Manager (NIM) on AIX systems. These resources include 'spot', lpp_source
bosinst_data
image_data
installp_bundle
fix_bundle
resolv_conf
exclude_files
adapter_def
Displaying NIM Resources
The res_show
The res_show
def res_show(module):
'''
Show nim resources.
arguments:
module (dict): The Ansible module
note:
Exits with fail_json in case of error
return:
updated results dictionary.
'''
cmd = '/usr/sbin/lsnim -l'
name = module.params['name']
object_type = module.params['object_type']
# This module will only show general information about the resource
# object class.
if not object_type and not name:
cmd += ' -c resources'
Creating NIM Resources
The res_create
The res_create
def res_create(nim_cmd, module):
'''
Define a NIM resource object.
arguments:
module (dict): The Ansible module
note:
Exits with fail_json in case of error
return:
updated results dictionary.
'''
opts = ""
name = module.params['name']
object_type = module.params['object_type']
attributes = module.params['attributes']
if object_type:
if object_type == "res_group":
cmd = nim_cmd + ' -o define '
else:
Deleting NIM Resources
The res_delete
The res_delete
def res_delete(nim_cmd, module):
'''
Remove a NIM resource object.
arguments:
module (dict): The Ansible module
note:
Exits with fail_json in case of error
return:
updated results dictionary.
'''
name = module.params['name']
cmd = nim_cmd + f' -o remove {name}'
if module.check_mode:
results['msg'] = f'Command \'{cmd}\' in preview mode, execution skipped.'
return
return_code, stdout, stderr = module.run_command(cmd)
Fetching NIM Resource Contents
The res_showres
lpp_source
The res_showres
def res_showres(module, resource, info):
"""
Fetch contents of valid NIM object resource
arguments:
module (dict): The Ansible module
resource (str): NIM resource name
info (info): NIM resource attributes information
return:
contents: (dict): NIM resource contents
"""
fail_msg = f'Unable to fetch contents of {resource}.'
max_retries = module.params['showres']['max_retries']
retry_wait_time = module.params['showres']['max_retries']
contents = {}
results['testing'] = ""
# 0042-001 nim: processing error encountered on "master":,
# 0042-207 m_showres: Unable to allocate the spot_72V_2114 resource to master.
pattern = r"0042-207"
if info['type'] in NIM_SHOWRES:
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human