Skip to content

Latest commit

 

History

History
 
 

Use Jinja templates with zos_copy

This playbook demonstrates how to use local Jinja templates to copy datasets and files in z/OS using Red Hat Ansible Certified Content for IBM Z.

This playbook uses:

  • collection:
    • ibm.ibm_zos_core
  • modules:
    • zos_copy
    • zos_gather_facts
    • zos_data_set

It is a good practice to review the playbook contents before executing them. It will help you understand the requirements in terms of space, location, names, authority, and the artifacts that will be created and cleaned up.

Playbook Requirements

This playbook requires:

The ansible.cfg file here contains the setting stdout_callback = unixy which changes the format of the playbook output. It has been set to better demonstrate the effects of whitespace (as compared to the default output formatting). The unixy callback is part of the community.general package (which is maintained by the Ansible community). The callback can be installed from Ansible Galaxy with the command:

ansible-galaxy collection install community.general

Alternatively, the stdout_callback = unixy line can be removed (or commented out) from the ansible.cfg file. The playbook will run the same, only the formatting of the playbook output, especially of whitespace, will be less apparent.

Configuration

Run the playbook

This project has included a site.yml playbook that serves as the primary playbook that provides additional prerequisite checks then it invokes the zos_copy_template.yml playbook.

If you want to run the primary playbook site.yml it will check that your environment has the correct version of Ansible as well as the collection needed to execute correctly. To run the primary playbook, use command:

ansible-playbook -i inventories site.yml

You can skip the prerequisite check and run zos_copy_template.yml with command:

ansible-playbook -i inventories zos_copy_template.yml

More information about Jinja templates can be found in its official documentation.

Changelog

All changes are maintained chronologically by date found in the changelog.

Copyright

© Copyright IBM Corporation 2023

License

Licensed under Apache License, Version 2.0.

Support

Please refer to the support section for more details.