IBM / ansible-for-i

the tool is to provide several customized modules for Ansible to manage IBM i systems.
GNU General Public License v3.0
55 stars 51 forks source link

The ibm_display_ptf module with the * ALL parameter - listing information about each PTF #102

Closed TSniad closed 3 years ago

TSniad commented 3 years ago

Hi all, I would like to use the ibm_display_ptf module to list information about every PTF on the system. I have tried to accomplish this by specifying *ALL in the pft field, but it ends up with this error:

FAILED! => {"changed": false, "job_log": [{"FROM_INSTRUCTION": "3", "FROM_LIBRARY": "QSYS", "FROM_MODULE": "QPZLSTFX", "FROM_PROCEDURE": "Send_message", "FROM_PROGRAM": "QPZLSTFX", "FROM_USER": "QSECOFR", "MESSAGE_FILE": "QCPFMSG", "MESSAGE_ID": "CPF6601", "MESSAGE_LIBRARY": "QSYS", "MESSAGE_SECOND_LEVEL_TEXT": "&N Cause . . . . . : No program temporary fixes (PTFs) for the specified product were found. &P -- No PTFs exists in save files in library QGPL. &P -- No PTFs for this product are on order. &P -- No cover letters exist for this product.", "MESSAGE_SUBTYPE": "EXCEPTION HANDLED", "MESSAGE_TEXT": "No PTF activity exists for product 5770XW1.", "MESSAGE_TIMESTAMP": "2021-05-12T12:27:16.255381", "MESSAGE_TYPE": "ESCAPE", "ORDINAL_POSITION": 26, "SEVERITY": 40, "TO_INSTRUCTION": "8", "TO_LIBRARY": "QSYS", "TO_MODULE": "QSQRTNPTF", "TO_PROCEDURE": "GetNextProductRecord", "TO_PROGRAM": "QDBSSUDF2"}, This error occurs for each of the products.

The code I am using:

---
- hosts: all
  gather_facts: no
  collections:
    - ibm.power_ibmi
  tasks:
    - name: DSPPTF
      ibmi_display_fix:
        ptf: '*ALL'

Is it or will it be possible to list all PTFs? Is it possible or will be possible to list PTF groups in the same way?

I would like to get a list of ptfs on the system and compare with the list of ptfs available on the repository located on another LPAR without using a network connection

changlexc commented 3 years ago

The purpose of this module is to retrieve the detail info for a PTF, but not list the PTFs.

I think you can use module ibmi_sql_query with option sql as input like "SELECT * FROM QSYS2.PTF_INFO" or just some of the columns like "SELECT PTF_IDENTIFIER FROM QSYS2.PTF_INFO" to get the list of PTFs on the system. About the usage of QSYS2.PTF_INFO view, refer to https://www.ibm.com/docs/en/i/7.4?topic=services-ptf-info-view

TSniad commented 3 years ago

Thanks for your help, the ibm_sql_query module solved my problem