Ansible for IBM Z

Ansible for IBM Z

Ansible for IBM Z

Facilitate communication, user interaction and feedback for Red Hat Ansible Certified Content for IBM Z

 View Only
Expand all | Collapse all

Ansible z/os core modules are failing in error.

  • 1.  Ansible z/os core modules are failing in error.

    Posted Wed September 13, 2023 10:13 AM

    Hi ,

    Initially I posted in IBMZ community discussion forum . 

    IBM Z and LinuxONE IBM Z

    Ibm remove preview
    IBM Z and LinuxONE IBM Z
    While trying to list APF Datasets, I am getting this error .Sample Play and task failing at "name: APF AMI OPS db2 Datasets"tasks: #- name: Ping DB2A
    View this on Ibm >

    Except zos_ping other modules are failing in error.

    These are the version of software packages being used

    zoaversion is 1.2.4  

    python 3.10 (on z/os) 

    Ansible Version
    ansible             8.3.0
    ansible-core        2.15.3

    Collection                    Version
    ----------------------------- -------
    ibm.ibm_zos_core              1.6.0  
    Python on zos is not SMPE maintained , it is received pax.z form so could not list applied maintenance  so not sure if any PTF is missing which is causing .
    I am just using a basic simple playbook 
     
    - name: List APF
      hosts: zosxxx
      gather_facts: False
      vars:
        #PYZ: /shrd/Zowenew/python-2017-04-12-py36/python36
        PYZ: /shrd/cyp/usr/lpp/IBM/cyp/v3r10/pyz
        ZOAU: /shrd/zoau1.2.4
        environment_vars:
          _BPXK_AUTOCVT: "ON"
          ZOAU_HOME: "{{ ZOAU }}"
          PYTHONPATH: "{{ ZOAU }}/lib"
          LIBPATH: "{{ ZOAU }}/lib:{{ PYZ }}/lib:/lib:/usr/lib:."
          PATH: "{{ ZOAU }}/bin:{{ PYZ }}/bin:/bin:/var/bin"
          # _CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
          # _TAG_REDIR_ERR: "txt"
          # _TAG_REDIR_IN: "txt"
          # _TAG_REDIR_OUT: "txt"
          # LANG: "C"
          PYTHONSTDINENCODING: "cp1047"
          #PYTHONIOENCODING: "utf-8"

      environment: "{{ environment_vars }}"
      tasks:
      - name: Ping {{ inventory_hostname }}
        ibm.ibm_zos_core.zos_ping:

      - name: List APF
        ibm.ibm_zos_core.zos_apf:
          operation: list
        register: myapf
    Host file entry
    db2a.xxx.com   ansible_connection=ssh  ansible_user=xxxxkj ansible_password=xxxxxx ansible_python_interpreter=/shrd/cyp/usr/lpp/IBM/cyp/v3r10/pyz/bin/python
    Error Received
    zos_apf fails with same error as reported earlier

    TASK [List APF] ******************************************************************************************************************************************************************************************************************
    task path: /root/myenv/newt.yml:25
    Using module file /root/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_apf.py
    Pipelining is enabled.
    <db2a.xxx.com> ESTABLISH SSH CONNECTION FOR USER: xxxxxx
    <db2a.xxx.com> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="xxxxxx"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/0494b81ceb"' db2a.xxx.com '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/shrd/zoau1.2.4 PYTHONPATH=/shrd/zoau1.2.4/lib LIBPATH=/shrd/zoau1.2.4/lib:/shrd/cyp/usr/lpp/IBM/cyp/v3r10/pyz/lib:/lib:/usr/lib:. PATH=/shrd/zoau1.2.4/bin:/shrd/cyp/usr/lpp/IBM/cyp/v3r10/pyz/bin:/bin:/var/bin PYTHONSTDINENCODING=cp1047 /shrd/cyp/usr/lpp/IBM/cyp/v3r10/pyz/bin/python3 && sleep 0'"'"''
    <db2a.xxx.com> (1, b'', b"SyntaxError: Non-UTF-8 code starting with '\\xa2' in file <stdin> on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details\n")
    <db2a.xxx.com> Failed to connect to the host via ssh: SyntaxError: Non-UTF-8 code starting with '\xa2' in file <stdin> on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
    fatal: [db2a.xxx.com]: FAILED! => {
        "changed": false,
        "module_stderr": "SyntaxError: Non-UTF-8 code starting with '\\xa2' in file <stdin> on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details\n",
        "module_stdout": "",
        "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
        "rc": 1
    }

    PLAY RECAP ***********************************************************************************************************************************************************************************************************************
    db2a.xxx.com               : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

    If I run same play as exercise on zos xplorer it works , there the zo au version 1.2 and python is 3.9 .
    Any suggestions will be helpful.
    Regards,
    Manoj K Jadwani


    ------------------------------
    Manoj Jadwani
    Product Manager
    BMC Software
    ------------------------------


  • 2.  RE: Ansible z/os core modules are failing in error.

    Posted Thu October 19, 2023 03:16 AM

    Hello Manoj, this has been replied to at here



    ------------------------------
    Demetri Dimatos
    IBM zOS Ansible Core Senior Technical Lead
    IBM
    San Jose CA
    ------------------------------