IBM Developer Blog

Follow the latest happenings with IBM Developer and stay in the know.

Explore a sample playbook that accompanies the recent release of IBM z/OS core collection


This blog post takes you through a sample playbook that accompanies the recent release of the IBM z/OS core collection.

Red Hat Ansible Certified Content for IBM Z

The IBM z/OS core collection is part of a broader offering known as the Red Hat Ansible Certified Content for IBM Z. This automation content enables you to start using Red Hat Ansible Automation Platform with IBM z/OS out of the box to unite workflow orchestration in one easy-to-use platform with:

  • Configuration management
  • Provisioning
  • Application deployment

At this point, you may be wondering Why should I be excited about this? Well, I’m glad you asked! Did you know that Ansible was one of the top 10 most contributed-to open source projects of 2019, and has been on the top 10 list since 2016, according to GitHub’s Octoverse? As a developer, I’m sure you appreciate the complexity that comes with provisioning and managing software and applications. With IBM’s recent (and continuing) contribution to the Ansible ecosystem, you can leverage Ansible to provide a single automation language to automate the z/OS platform.

If you aren’t yet familiar with Ansible’s simple automation language that can describe an IT application infrastructure from top to bottom via codifying the IT landscape, then check out how powerful Ansible can be out-of-the-box for your automation needs.

IBM z/OS core collection

In this initial release, we provide sample playbooks, modules, and plug-ins in the form of Ansible Content Collections that can help accelerate your use of Ansible against z/OS inventories.

We’ll start with four z/OS core modules for job and data set management in the IBM z/OS core collection with more to follow:

  • zos_job_submit, zos_job_query, zos_job_output: You can use these three modules to manage almost all of your JCL needs on z/OS; we wanted to ensure that you can leverage the existing JCL that you have for automating your systems as well as use dynamic and flexible JCL templates for more advanced JCL automation with Ansible.
  • zos_data_set: This module allows you to create, delete, and manage attributes for your data sets without having to write any JCL.

You can find the certified and supported versions on Ansible Automation Hub (search for “zos”).

  • Note: a subscription to the Red Hat Ansible Automation Platform is required to access this supported content.

You can find our open source community versions on Ansible Galaxy.

For technical documentation on IBM z/OS core collection, visit the docs pages.

How to run the playbook

And to give you a taste of what we’re offering, we’ll use the IBM z/OS core collection v1.0.0 (available on both Galaxy and Automation Hub) and show you how to use these modules in a playbook: ibm_zos_core/playbooks/zos-collection-sample.yaml.

  1. Edit the ansible.cfg file to include pipelining = True.
  2. Modify the sample inventory to add the z/OS host, user, and Python location.
  3. Update the group_vars in the all.yml file to point to the locations of ZOAU and Python on the target z/OS host.
  4. Run the Ansible playbook by running the following command from the same directory that your playbook is located in:
    ansible-playbook -i inventory zos-collection-sample.yaml
    

Job management

Here’s a brief overview of the sample playbook and the tasks being performed by zos_job_submit, zos_job_query, and zos_job_output:

  1. Ping the host to ensure that the z/OS target node is reachable.
  2. Ensure that the correct JCL folder exists.
  3. zos_job_submit writes and submits a HELLO JCL job to the system.
  4. zos_job_query queries that submitted HELLO job.
  5. zos_job_output retrieves the job output
  6. The HELLO job and its folder are deleted from the system.

Note: Steps 3 through 5 can be performed by using only zos_job_submit with a single invocation, however the additional modules are provided to enable performing those actions individually.

Data set manipulation

Here’s an overview of how zos_data_set is used in the sample playbook:

  1. zos_data_set creates a PDS data set named USER.PRIVATE.TEST. Ensure that you have the authority to create high-level qualifiers that are defined in the data set name.
  2. Check that the data set was successfully created.
  3. zos_data_set deletes the newly created PDS data set USER.PRIVATE.TEST.

So there you have it! We hope you enjoy getting started with the first release of our IBM z/OS core collection.

Stay tuned for more content!

Resources

For additional information on Red Hat Ansible Certified Content for IBM Z please visit: