|
1 | | -# ibm_zos_core |
| 1 | +# Red Hat Ansible Certified Content for IBM Z |
| 2 | +__Red Hat® Ansible Certified Content for IBM Z__ provides the ability to connect IBM Z® to clients' wider enterprise automation strategy through the Ansible Automation Platform ecosystem. The __Red Hat Ansible Certified Content for IBM Z core collection__ (`ibm_zos_core`) enables development and operations to automate on Z by providing Ansible support for tasks such as creating data sets, submitting jobs, querying jobs, and retrieving job output. |
| 3 | + |
| 4 | +# Features |
| 5 | +The __Red Hat Ansible Certified Content for IBM Z core collection__ `ibm_zos_core` includes [connection plugins](plugins/connection/), [action plugins](plugins/action/), [modules](plugins/modules/), [sample playbooks](playbooks/), and ansible-doc to automate tasks on Z. |
| 6 | + |
| 7 | +These features enable a seamless, unified workflow orchestration with configuration management, provisioning, and application deployment in one easy-to-use platform. |
| 8 | + |
| 9 | +# Plugins |
| 10 | + |
| 11 | +## Action |
| 12 | +* [normal](docs/README-zos-rexx-connection-plugin.md): A fork of [Ansible _normal.py_ action plugin](https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/action/normal.py) that is modified to allow a conditional shebang line in REXX modules. |
| 13 | +* [zos_job_submit](docs/README-zos-job-submit.md): Used to submit a job from the controller and optionally monitor for completion. |
| 14 | + |
| 15 | +## Connection |
| 16 | +* [zos_ssh](docs/README-zos-rexx-connection-plugin.md): Enables the Ansible controller to communicate to a Z target machine by using ssh with the added support to transfer ASCII as EBCDIC when transferring REXX modules. The connection plugin was forked from the [Ansible _ssh.py_ connection plugin](https://github.com/ansible/ansible/blob/480b106d6535978ae6ecab68b40942ca4fa914a0/lib/ansible/plugins/connection/ssh.py). |
| 17 | + |
| 18 | +# Modules |
| 19 | +* [zos_data_set](docs/README-zos-data-set.md): Create, delete, and manage attributes for data sets. |
| 20 | +* [zos_job_query](docs/README-zos-job-query.md): Query Z for a list of jobs. |
| 21 | +* [zos_job_submit](docs/README-zos-job-submit.md): Submit a job and optionally monitor for completion. |
| 22 | +* [zos_job_output](docs/README-zos-job-output.md): Capture the job output for a submitted job. |
| 23 | + |
| 24 | +# Playbooks |
| 25 | +[Sample playbooks](playbooks/) are included that demonstrate how to use the collection content in the `ibm_zos_core` collection. |
| 26 | +See the [playbooks README](playbooks/README.md) for detailed instructions and configuration information. |
| 27 | + |
| 28 | +# Requirements |
| 29 | + |
| 30 | +A control node is any machine with Ansible installed. From the control node, you can run commands and playbooks from a laptop, desktop, or server machine. However, you cannot run them on a Windows machine. |
| 31 | + |
| 32 | +A managed node is often referred as a target node or host and is the node that is managed by Ansible. Ansible does not need not be installed on a managed node, but SSH must be eanabled. |
| 33 | + |
| 34 | +The following nodes require specific versions of software: |
| 35 | + |
| 36 | +## Control node |
| 37 | +* [Ansible version](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html): 2.9 or later |
| 38 | +* [Python](https://www.python.org/downloads/release/latest): 2.7 or later |
| 39 | +* [OpenSSH](https://www.openssh.com/) |
| 40 | + |
| 41 | +## Managed node (target) |
| 42 | +* [Python](docs/README-python-zos.md): 3.6 or later |
| 43 | +* [z/OS](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2/zos-v2r2-home.html): V02.02.00 |
| 44 | +* [IBM Z Open Automation Utilities](docs/README-ZOAU.md): 1.0.1 (PTF UI66957 or later) |
| 45 | +* [OpenSSH](https://www.openssh.com/) |
| 46 | + |
| 47 | +# Installation |
| 48 | +You have several options when you are ready to install the Red Hat Ansible Certified Content for IBM Z core collection that includes Ansible Galaxy, Ansible Hub, and local. For more information on installing collections, see [Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html). |
| 49 | + |
| 50 | +## Ansible Galaxy |
| 51 | +You can use the [ansible-galaxy](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html) command with the option `install` to install a collection on your system (control node) hosted in Galaxy. |
| 52 | + |
| 53 | +Galaxy enables you to quickly configure your automation project with content from the Ansible community. Galaxy provides prepackaged units of work known as collections. |
| 54 | + |
| 55 | +Here's an example command for installing the Red Hat Ansible Certified Content for IBM Z core collection: |
| 56 | +``` |
| 57 | +ansible-galaxy collection install ibm.ibm_zos_core |
| 58 | +``` |
| 59 | + |
| 60 | +The collection installation progress will be output to the console. Note the location of the installation so that you can review other content included with the collection, such as the sample playbook. By default, collections are installed in `~/.ansible/collections`. |
| 61 | + |
| 62 | +In this sample output of the collection installation, note the installation path to access the sample playbook: |
| 63 | +``` |
| 64 | +Process install dependency map |
| 65 | +Starting collection install process |
| 66 | +Installing 'ibm.ibm_zos_core:0.0.1' to '/Users/user/.ansible/collections/ansible_collections/ibm/ibm_zos_core' |
| 67 | +``` |
| 68 | + |
| 69 | +Installed collection content: |
| 70 | +``` |
| 71 | +├── collections/ |
| 72 | +│ ├── ansible_collections/ |
| 73 | +│ ├── ibm/ |
| 74 | +│ ├── ibm_zos_core/ |
| 75 | +│ ├── docs/ |
| 76 | +│ ├── playbooks/ |
| 77 | +│ ├── plugins/ |
| 78 | +│ ├── action/ |
| 79 | +│ ├── connection/ |
| 80 | +│ ├── module_utils/ |
| 81 | +│ └── modules/ |
| 82 | +``` |
| 83 | + |
| 84 | +You can use the `-p` option with `anasible-galaxy` to specify the installation path such as `ansible-galaxy collection install ibm.ibm_zos_core -p /home/ansible/collections`. For more information on installing collections with Ansible Galaxy, see [Installing collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-collections-with-ansible-galaxy). |
| 85 | + |
| 86 | +## Automation Hub and private Galaxy server |
| 87 | +You can use the [ansible-galaxy](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html) command with option `install` to install a collection on your system (control node) hosted in Hub or a private Galaxy server. |
| 88 | + |
| 89 | +By default, the `ansible-galaxy` command uses https://galaxy.ansible.com as the Galaxy server when you install a collection. The `ansible-galaxy` client can be configured to point to _HUB_ or other servers, such as a privately running Galaxy server, by configuring the server list in the `ansible.cfg` file. |
| 90 | + |
| 91 | +Ansible searches for `ansible.cfg` in these locations in this order: |
| 92 | +* ANSIBLE_CONFIG (environment variable if set) |
| 93 | +* ansible.cfg (in the current directory) |
| 94 | +* ~/.ansible.cfg (in the home directory) |
| 95 | +* /etc/ansible/ansible.cfg |
| 96 | + |
| 97 | +To configure a Galaxy server list in the ansible.cfg file: |
| 98 | +1. Add the server_list option under the [galaxy] section to one or more server names. |
| 99 | +2. Create a new section for each server name. |
| 100 | +3. Set the url option for each server name. |
| 101 | +4. Set the auth_url option for each server name. |
| 102 | +5. Set the API token for each server name. For more information on API tokens, see [Get API token from the version dropdown to copy your API token] (https://cloud.redhat.com/ansible/automation-hub/token/). |
| 103 | + |
| 104 | +The following example shows a configuration for Hub, a private running Galaxy server, and Galaxy: |
| 105 | +``` |
| 106 | +[galaxy] |
| 107 | +server_list = automation_hub, release_galaxy, private_galaxy |
| 108 | +
|
| 109 | +[galaxy_server.automation_hub] |
| 110 | +url=https://cloud.redhat.com/api/automation-hub/ |
| 111 | +auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token |
| 112 | +token=hub_token |
| 113 | +
|
| 114 | +[galaxy_server.release_galaxy] |
| 115 | +url=https://galaxy.ansible.com/ |
| 116 | +token=release_token |
| 117 | +
|
| 118 | +[galaxy_server.private_galaxy] |
| 119 | +url=https://galaxy-dev.ansible.com/ |
| 120 | +token=private_token |
| 121 | +``` |
| 122 | + |
| 123 | +For more configuration information, see [Configuring the ansible-galaxy client](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#galaxy-server-config) and [Ansible Configuration Settings](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings). |
| 124 | + |
| 125 | +## Local build |
| 126 | +You can use the `ansible-galaxy collection install` command to install a collection built from source. To build your own collection, you must clone the Git repository, build the collection archive, and install the collection. The `ansible-galaxy collection build` command packages the collection into an archive that can later be installed locally without having to use Hub or Galaxy. |
| 127 | + |
| 128 | +To build your own collection: |
| 129 | + |
| 130 | +1. Clone the sample repository: |
| 131 | +``` |
| 132 | +git clone [email protected]:ansible-collections/ibm_zos_core.git |
| 133 | +``` |
| 134 | + |
| 135 | +Collection archive names will change depending on the relase version. They adhere to this convention `<namespace>-<collection>-<version>.tar.gz`, for example, `ibm-ibm_zos_core-0.0.1.tar.gz` |
| 136 | + |
| 137 | +2. Build the collection by running the `ansible-galaxy collection build` command, which must be run from inside the collection: |
| 138 | +``` |
| 139 | +cd ibm_zos_core |
| 140 | +ansible-galaxy collection build |
| 141 | +``` |
| 142 | +Example output of a locally built collection: |
| 143 | +``` |
| 144 | +user:[ ~/git/ibm/ibm_zos_core ]ansible-galaxy collection build |
| 145 | +Created collection for ibm.ibm_zos_core at /Users/user/git/ibm/zos-ansible/ibm_zos_core/ibm-ibm_zos_core-0.0.1.tar.gz |
| 146 | +``` |
| 147 | + |
| 148 | +__Note__: If you build the collection with Ansible version 2.9 or earlier, you will see the following warning that you can ignore. |
| 149 | +`[WARNING]: Found unknown keys in collection galaxy.yml at '/Users/user/git/ibm/zos-ansible/ibm_zos_core/galaxy.yml': build_ignore` |
| 150 | + |
| 151 | +You can use the `-p` option with `anasible-galaxy` to specify the installation path, for example, `ansible-galaxy collection install ibm-ibm_zos_core-0.0.1.tar.gz -p /home/ansible/collections`. For more information, see [Installing collections with Ansible Galaxy] (https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-collections-with-ansible-galaxy). |
| 152 | + |
| 153 | +3. Install the locally built collection: |
| 154 | +``` |
| 155 | +ansible-galaxy collection install ibm-ibm_zos_core-0.0.1.tar.gz |
| 156 | +``` |
| 157 | + |
| 158 | +In the output of collection installation, note the installation path to access the sample playbook: |
| 159 | +``` |
| 160 | +Process install dependency map |
| 161 | +Starting collection install process |
| 162 | +Installing 'ibm.ibm_zos_core:0.0.1' to '/Users/user/.ansible/collections/ansible_collections/ibm/ibm_zos_core' |
| 163 | +``` |
| 164 | + |
| 165 | +# Usage |
| 166 | +## Collection |
| 167 | +After the collection is installed, you can access collection content for a playbook by referencing the name space `ibm` and collections fully qualified name `ibm_zos_core`, for example: |
| 168 | + |
| 169 | +``` |
| 170 | +- hosts: all |
| 171 | +
|
| 172 | + tasks: |
| 173 | + - name: Query submitted job 'HELLO' |
| 174 | + ibm.ibm_zos_core.zos_job_query: |
| 175 | + job_name: HELLO |
| 176 | +``` |
| 177 | + |
| 178 | +In Ansible 2.9, the `collections` keyword was added and reduces the need to refer to the collection repeatedly. For example, you can use the `collections` keyword in your playbook: |
| 179 | +``` |
| 180 | +- hosts: all |
| 181 | + collections: |
| 182 | + - ibm.ibm_zos_core |
| 183 | + |
| 184 | + tasks: |
| 185 | + - name: Query submitted job 'HELLO' |
| 186 | + zos_dataset: |
| 187 | + job_name: HELLO |
| 188 | +``` |
| 189 | + |
| 190 | +## ansible-doc |
| 191 | +Modules included in this collection provide additional documentation that is similar to a UNIX or UNIX-like operating system man page (manual page). This documentation an be accessed from the command line by using the `ansible-doc` command. |
| 192 | + |
| 193 | +Here's how to use the Ansible-supplied command after you install the _Red Hat Ansible Certified Content for IBM Z core collection_: |
| 194 | +`ansible-doc ibm.ibm_zos_core.zos_data_set` |
| 195 | + |
| 196 | +``` |
| 197 | +> ZOS_DATA_SET (/Users/user/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_data_set.py) |
| 198 | +
|
| 199 | + Create, delete and set attributes of data sets. When forcing data set replacement, contents will not be |
| 200 | + preserved. |
| 201 | +
|
| 202 | + * This module is maintained by The Ansible Community |
| 203 | +OPTIONS (= is mandatory): |
| 204 | +
|
| 205 | +- batch |
| 206 | + Batch can be used to perform operations on multiple data sets in a single module call. |
| 207 | + Each item in the list expects the same options as zos_data_set. |
| 208 | + [Default: (null)] |
| 209 | + type: list |
| 210 | + version_added: 2.9 |
| 211 | +
|
| 212 | +- data_class |
| 213 | + The data class name (required for SMS-managed data sets) |
| 214 | + [Default: (null)] |
| 215 | + type: str |
| 216 | + version_added: 2.9 |
| 217 | +``` |
| 218 | + |
| 219 | +# Helpful Links |
| 220 | +* [Getting started Ansible guide](https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html). |
| 221 | + |
| 222 | +# Contributing |
| 223 | +Currently we are not accepting community contributions. Periodically review this content on when and how contributions could be contributed. |
| 224 | + |
| 225 | +# Copyright |
| 226 | +© Copyright IBM Corporation 2020 |
| 227 | + |
| 228 | +# License |
| 229 | +Portions of this collection are licensed under [GNU General Public License, Version 3.0](https://opensource.org/licenses/GPL-3.0), |
| 230 | +and portions of this collection are licensed under [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0). |
| 231 | +See individual files for applicable licenses. |
| 232 | + |
0 commit comments