Ansible for IBM Z

  • 1.  Issue a WTOR in ansible playbook

    Posted Tue May 28, 2024 09:34 AM

    Hi,

    is there a ansible module I can use to issue a WTOR or can this only be done by sumitting a job or running a REXX script?

    Kind regards

    Martin



    ------------------------------
    Martin Weiß
    ------------------------------


  • 2.  RE: Issue a WTOR in ansible playbook

    Posted Wed May 29, 2024 12:16 PM

    Hi @Martin, there is no Ansible module dedicated to a WTO or WTOR, it was something we put on the books a few yrs ago that continued to get deprioritized over other features, we might be able to contain that in the coming year.

    In my experience I have only ever performed a WTOR using the assembler macro and a few other low programming models, you should be able to do this with the ways you mentioned (JCL, REXX) and if in JCL you could also use the 'zos_mvs_raw' module. 

    If it were me, I would be thinking how to do this in a reusable fashion such that the message is a variable and then substitute that accordingly; for that you can use Ansible vars, and the dynamic medium can be :
    1) Jinja templating either through zos_job_submit (JCL) or zos_script (REXX), use your var with the template
    2) zos_mvs_raw and use the var with the `dd_input` > `content` section
    3) zos_copy, inline some REXX/JCL with the `var` using the modules content option that can dynamically write to USS or a DataSet then follow up with execution which will var, eg if you write JCL into a data set or USS, follow up with zos_job_submit. 

    Another option is `AXRWTOR` which I believe came out in z/OS 2VR2, from this you could use the `zos_script` module + JINJA templating to create a reusable snippet (I took this from the operations guide: https://www.redbooks.ibm.com/redbooks/pdfs/sg248305.pdf) section 10.2.4.

    Reply was a bit verbose, but hope it helps.

    F AXR,SENDWTOR,T=0
    /* REXX using WTOR */ 503
     connect_id = "FIRSTLINE"; lines = Sourceline()
     Do i=1 To lines; Call Axrmlwto Sourceline(i), "connect_id", "D"; End
     Call AXRMlwto, "connect_id", "E"
     Call AXRWtor "Reply to this message with any text."
     Call AXRWto "Replied data is:" AxrReply /* Reply stored in AxrReply */
     Exit
    *017 Reply to this message with any text.
     R 17,'This is an arbitrary text.'
     IEE600I REPLY TO 017 IS;'This is an arbitrary text.'
     Replied data is: This is an arbitrary text.





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



  • 3.  RE: Issue a WTOR in ansible playbook

    Posted Mon June 03, 2024 05:03 PM
    Edited by Demetri Dimatos Mon June 03, 2024 05:04 PM

    @Martin, I forgot to mention to you that we also have a filter that can help with scraping for messages to reply too. Plugins are not currently supported by the doc site since we just added the documentation requirement, so you can read about it here and review the detail documentation in the plugins source that includes an example, there is also examples in the sample playbook repository. 



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



  • 4.  RE: Issue a WTOR in ansible playbook

    Posted Fri September 27, 2024 01:27 PM

    Hi @Martin Weiß, I see this was already answered, but @Demetri Dimatos I'm wondering if the ibm.ibm_zos_core.zos_operator_action_query module could work here also? Unless I'm mistaken as to what that module's function is (which I very well may be), it queries WTORs, which then can be printed via the debug module, and acted upon with the ibm.ibm_zos_core.zos_operator module.

    Here's an example from the z_ansible_collections_samples repository on GitHub, and here's a simple example from one of my playbooks.



    ------------------------------
    Jacob Emery
    ------------------------------