Ansible for IBM Z - Group home

IBM Ansible z/OS Core 1.8.0 has released !!!


IBM z/OS Ansible Core 1.8.0 has released to Automation Hub,  Galaxy and is available in GitHub. With less than than 10 days left before Christmas, this is the perfect collection to have your orchestration provision some trees, automation update decorations and simplify your holidays with some playbooks. This release includes a new zos_script module capable of interacting with REXX; 15 enhancements you won't want to miss and 11 bugfixes, what an incredible way to end the year. 

New Module

The latest zos_script module is capable of running REXX, Python and Shell when the scripts are either on the control node or on the z/OS managed node. The module can securely transfer the script, remove it on completion and if necessary, ensure the correct encodings are used. In a previous release blog , we discussed the latest Jinja templating and provided some use cases, now this powerful templating capability has been made available to the zos_script module, allowing you to generate dynamic content, reduce redundancy and minimize both syntax, and source errors. 

For example, run a REXX script located in /u/user/scripts and have the script change into directory /u/user/output_dir before executing so its output is written to output_dir:

- name: Run a REXX script on the managed z/OS node
    cmd: /u/user/scripts/ARGS "1,2"
    remote_src: true
    chdir: /u/user/output_dir

Don't stop there, checkout the zos_script modules other capabilities like being able to execute a script only when another file exists or does not exist using options creates and removes. You might also want to reduce the number of scripts you manage and template some of them with use_template or direct the module which directory to copy temporary scripts into using Ansible's remote_tmp option.


From our 23 modules, 10 were enhanced and will discuss the most noteworthy changes, in the meantime, please review the release notes or changelog for additional details. 

The zos_copy module now supports copying executables such as program objects and load modules, ensures that aliases are retained and if the source contains ASA carriage control characters, they are preserved. ASA control characters are printing command characters generally not visible but used to control the movement of text through printers or log readers. Additionally, the module can forcibly copy into a data set which is in use by another process using the option force_lock. 

 These new options are:

  • asa_text
  • executable
  • aliases
  • force_lock

Internally, the modules security posture along with modules zos_archive, zos_fetch, zos_unarchive all have been improved to detect unauthorized path traversals. 

For the other enhancements:

- zos_job_submit's transport architecture was updated to use the same technology our other modules use and a performance enhancement was introduced that reduced unnecessary queries when the modules  return_output is set to false. 

- zos_operator's option wait was updated such that when using ZOAU 1.2.5 or later, the time set for wait_time_s becomes a blocking call, for example, a wait_time_s=10 instructs the module to wait the full 10 seconds, whether or not the command completed. This was introduced to reduce the occasional partial result that would result from a segmented operator command response. When using ZOAU less than version 1.2.5, the behavior remained the same which was wait to up to 10 seconds and would return sooner if the module detected a response, which could be problematic if its a segmented response. 

- zos_operator_action_query when querying for actionable operations, the module will wait up to 5 seconds for a response. 

- zos_script replaced the previous beta option tmp_path with Ansibles remote_tmp option which defaults to ~/.ansible/tmp and can be configured through an:
INI entry:

remote_tmp = ~/.ansible/tmp


Playbook variable: ansible_remote_tmp



  • added the missing LIBRARY type when using option dest_data_set.
  • fixed an issue that when copying an executable from the controller to the managed node, would undergo encoding conversion.
  • fixed an issue that when copying an executable data set with aliases and destination did not exist, destination data set was created with incorrect attributes.
  • fixed an issue that when copying to existing file (replace), the copied file resulted in having corrupted contents.


  • fixed an issue where temporary files were left on the z/OS managed node.
  • fixed an issue where the last character of a job would be truncated on job submission.


  • fixed an issue where a duplicate insertion would be made even if the match was already present causing duplicate entries.


  • fixed an issue where the last line of a response would be truncated.
  • fixed an issue where the module was ignoring the value set for option wait_time.


  • fixed an issue where the module was ignoring the value set for option wait_time.


  • fixes an issue when the module fails unpacking either with xmit or terse, it does not clean the temporary data sets that were created. 

I recommend reading over the release notes as well as the changelog, this will provide you an understanding of the all the changes and known issues. 

About the Authors
Demetrios Dimatos is the IBM z/OS Ansible Core Senior Technical Lead with 16 years mainframe experience and over 20 years of development experience; having led multiple products ranging from client server technologies, administration consoles, IBM Open Platform (Hadoop - HDFS, MapReduce, Yarn) and Spark, Linux, and Solaris kernel development. 

Oscar Fernando Flores Garcia is an IBM z/OS Ansible Core software engineer designing and developing many of the collections modules and responsible for many of the product releases. 


IBM Ansible z/OS core on Galaxy
IBM Ansible Core Collection Repository on GitHub
IBM Ansible Core Collection on Automation Hub
Red Hat® Ansible Certified Content for IBM Z documentation