If you wonder or struggle to compare a fileset, or ptf, or package version on AIX, then you are on the right place. First thing first, let’s gather our filesets details in the ansible_facts:
- name: Extract bos.mp64 fileset version
ibm.power_aix.lpp_facts:
filesets:
- bos.adt.base
- bos.adt.lib
- bos.mp64
Then we extract the version string from the dict:
- set_fact:
version_string: "{{ item.key }}"
loop: "{{ ansible_facts.filesets['bos.mp64'].levels | dict2items }}"
when: item.value.vrmf is defined
register: version_fact
- name: Check bos.mp64 version
debug:
msg: "ifix #IJ04311 needs to be applied: bos.mp64 {{ version_string }}."
when: "'bos.mp64' in ansible_facts.filesets and version_string is version('7.1.5.43', '<')"
And finally the playbook output:
ok: [aixbox] =>
(item=
{'key': '7.1.5.43',
'value':
{'vrmf':
{'ver': 7, 'rel': 1, 'mod': 5, 'fix': 43},
'state': 'committed',
'type': 'install',
'description': 'Base Operating System 64-bit Multiprocessor Runtime',
'emgr_locked': False,
'sources': ['/usr/lib/objrepos', '/etc/objrepos']
}
}
) => {"ansible_facts":
{"version_string": "7.1.5.43"},
"ansible_loop_var": "item",
"changed": false,
"item":
{"key": "7.1.5.43",
"value":
{"description": "Base Operating System 64-bit Multiprocessor Runtime",
"emgr_locked": false,
"sources": ["/usr/lib/objrepos", "/etc/objrepos"],
"state": "committed",
"type": "install",
"vrmf":
{"fix": 43, "mod": 5, "rel": 1, "ver": 7}
}
}
}
TASK [Check bos.mp64 version]
skipping: [aixbox] =>
{"false_condition":
"'bos.mp64' in ansible_facts.filesets and version_string is version('7.1.5.43', '<')"}
Yes, you are welcomed. ^^


Leave a Reply
You must be logged in to post a comment.