You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docsite/rst/os_guide/intro_zos.rst
+51-50Lines changed: 51 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -5,54 +5,55 @@ Managing z/OS hosts with Ansible
5
5
================================
6
6
7
7
8
-
Ansible can connect to `IBM UNIX System Services <https://www.ibm.com/docs/en/zos/3.1.0?topic=descriptions-zos-unix-system-services>`_ to bring your Ansible Automation strategy to IBM z/OS.
8
+
Ansible can connect to `IBM UNIX System Services <https://www.ibm.com/docs/en/zos/latest?topic=descriptions-zos-unix-system-services>`_ to bring your Ansible Automation strategy to IBM z/OS.
9
9
This enables development and operations automation on IBM Z through a seamless,
10
10
unified workflow orchestration with configuration management, provisioning, and application deployment with
11
11
the easy-to-use Ansible platform.
12
12
13
13
14
-
Ansible and UNIX System Services
15
-
---------------------------------
16
-
UNIX System Services can support the required dependencies for an Ansible managed node including running python and
14
+
Ansible and z/OS UNIX System Services
15
+
-------------------------------------
16
+
UNIX System Services can support the required dependencies for an Ansible managed node including running Python and
17
17
spawning interactive shell processes through SSH connections.
18
18
Ansible can target UNIX System Services nodes to modify files, directories, etc. through built-in Ansible community modules.
19
19
Further, anything that one can do by typing command(s) into the UNIX System Services shell can be captured
20
20
and automated in an Ansible playbook.
21
21
22
-
To learn more about z/OS managed nodes,
22
+
To learn more about z/OS managed nodes,
23
23
see `Red Hat Certified Content for IBM Z <https://ibm.github.io/z_ansible_collections_doc/>`_.
24
24
25
25
26
26
The z/OS Landscape
27
-
-------------------
28
-
While most systems process files in two modes - binary or UTF-8 encoded text,
29
-
IBM Z including UNIX System Services features an additional third flavor - text encoded in EBCDIC.
27
+
------------------
28
+
While most systems process files in two modes - binary or UTF-8 encoded text,
29
+
IBM Z including UNIX System Services features an additional third mode - text encoded in EBCDIC.
30
30
Ansible has provisions to handle binary data and UTF-8 encoded textual data, but not EBCDIC encoded data.
31
31
This is not necessarily a limitation, it simply requires additional tasks that convert files to/from their original encodings.
32
32
It is up to the Ansible user managing z/OS nodes to understand the nature of the files in their automation.
33
33
34
34
The type (binary or text) and encoding of files can be stored in file "tags".
35
-
File tags is a z/OS UNIX System Services concept (part of enhanced ASCII) which was established to distinguish binary
35
+
File tags is a z/OS UNIX System Services concept (part of Enhanced ASCII) which was established to distinguish binary
36
36
files from UTF-8 encoded text files and EBCDIC-encoded text files.
37
37
38
-
Default behavior for an un-tagged file or stream is determined by the program, for example,
38
+
Default behavior for an un-tagged file or stream is determined by the program, for example,
39
39
`IBM Open Enterprise SDK for Python <https://www.ibm.com/products/open-enterprise-python-zos>`__ defaults to the UTF-8 encoding.
40
40
41
-
Ansible modules will not read or honor any file tags. It is up to the user to determine the nature of remote data and tag it appropriately.
42
-
Data sent to remote z/OS nodes is by default encoded in UTF-8 and is not tagged.
43
-
This is achieveable with an additional task using the ``builtin.command`` module and applying any necessary encoding conversion.
41
+
Ansible modules will not read or recognize file tags. It is up to the user to determine the nature of remote data and tag it appropriately.
42
+
Data sent to remote z/OS nodes is by default, encoded in UTF-8 and is not tagged.
43
+
Tagging a file is achievable with an additional task using the ``ansible.builtin.command`` module.
The z/OS UNIX remote shell defaults to an EBCDIC encoding for un-tagged data streams.
51
+
The `z/OS shell <https://www.ibm.com/docs/en/zos/latest?topic=shells-introduction-zos>`_ available on
52
+
z/OS UNIX System services defaults to an EBCDIC encoding for un-tagged data streams.
52
53
This mismatch in data encodings can be resolved with the ``PYTHONSTDINENCODING`` environment variable,
53
-
which tags the pipe used by python with the specified encoding.
54
-
File and pipe tags can be used for automatic conversion between ASCII and EBCDIC.
55
-
But only by programs on z/OS which are aware of tags and honor them.
54
+
which tags the pipe used by Python with the specified encoding.
55
+
File and pipe tags can be used with automatic conversion between ASCII and EBCDIC, but only programs on
56
+
z/OS which are aware of tags can use them.
56
57
57
58
58
59
Using Ansible Community Modules with z/OS
@@ -65,22 +66,22 @@ On z/OS, since text data (file or stream) is sometimes encoded in EBCDIC and som
65
66
Here are some notes / pro-tips when using the community modules with z/OS. This is by no means a comprehensive list.
66
67
67
68
* ansible.builtin.command / ansible.builtin.shell
68
-
The command and shell modules are excellent for automating tasks for which command line solutions already exist.
69
-
The thing to keep in mind when using these modules is depending on the system configuration, the Z shell (``/bin/sh``) may return output in EBCDIC.
70
-
The LE environment variable configurations will correctly convert streams if they are tagged and make output look sensible on the Ansible side.
69
+
The command and shell modules are excellent for automating tasks for which command line solutions already exist.
70
+
The thing to keep in mind when using these modules is that depending on the system configuration, the z/OS shell (``/bin/sh``) may return output in EBCDIC.
71
+
The LE environment variable configurations will correctly convert streams if they are tagged and return readable output on the Ansible side.
71
72
However, some command line programs may return output in UTF-8 and not tag the pipe.
72
-
In this case, the autoconversion may incorrectly assume output is in EBCDIC and attempt to convert it and wind up with yet more unreadable data.
73
-
If the source encoding can be determined, since the ``ansible.builtin.command`` module allows chaining together commands through pipes,
74
-
try piping the output through a call to ``iconv``. You may need to play around with the 'to' and 'from' encodings to determine the correct set.
73
+
In this case, the autoconversion may incorrectly assume output is in EBCDIC and attempt to convert it and yield unreadable data.
74
+
If the source encoding is known, you can use the ``ansible.builtin.command`` module's capability to chain commands together through pipes,
75
+
and pipe the output to ``iconv``. In this example, you may need to select other encodings for the 'to' and 'from' that represent your file encodings.
The raw module, by design, ignores all remote environment settings. However, UNIX System Services managed nodes require some base configurations.
83
-
One trick to use this module with UNIX System Services is to pass in the bare minimal environment variables as a chain of export statements before the desired command.
83
+
The raw module, by design, ignores all remote environment settings. However, z/OS UNIX System Services managed nodes require some base configurations.
84
+
To use this module with UNIX System Services, configure the minimum environment variables as a chain of export statements before the desired command.
84
85
85
86
.. code-block:: yaml
86
87
@@ -99,19 +100,19 @@ Here are some notes / pro-tips when using the community modules with z/OS. This
99
100
* ansible.builtin.copy / ansible.builtin.fetch
100
101
The built in community modules will NOT automatically tag files, nor will existing file tags be honored nor preserved.
101
102
You can treat files as binaries when running copy/fetch operations, there is no issue in terms of data integrity,
102
-
just remember to restore the correct tag and encoding once the file is returned to z/OS, as that data will not be stored for you.
103
+
but remember to restore the file tag and encoding once the file is returned to z/OS, as tags are not preserved.
These modules process all data in UTF-8, so be sure to convert files to UTF-8 beforehand and re-tag the resulting files after.
106
+
These modules process all data in UTF-8, you must convert files to UTF-8 beforehand and re-tag the resulting files after.
106
107
107
108
* ansible.builtin.script
108
109
The built in script module copies a local file over to a remote target and attempts to run it.
109
-
The issue that UNIX System Services targets run into is that the file does not get tagged as UTF-8 text.
110
-
When the underlying shell attempts to read the untagged script file, it will assume the default,
110
+
The issue that z/OS UNIX System Services targets run into is that the file does not get tagged as UTF-8 text.
111
+
When the underlying z/OS shell attempts to read the untagged script file, it will assume the default,
111
112
that the file is encoded in EBCDIC, and the file will not be read correctly and the script will not run.
112
-
One work-around is to manually copy local files over (``ansible.builtin.copy`` ) and convert or tag files (with the ``ansible.builtin.command`` module).
113
-
With this work-around, some of the niceties of the script module are lost, such as automatically cleaning up the script file once it's run,
114
-
but it is trivial to recreate those steps as separate playbook tasks.
113
+
One work-around is to copy local files to the managed node (``ansible.builtin.copy`` ) and convert or tag files (with the ``ansible.builtin.command`` module).
114
+
With this work-around, some of the conveniences of the script module are lost, such as automatically cleaning up the script file once it's run,
115
+
but it is trivial to perform those steps as additional playbook tasks.
115
116
116
117
.. code-block:: yaml
117
118
@@ -126,15 +127,15 @@ Here are some notes / pro-tips when using the community modules with z/OS. This
Another somewhat convoluted work-around is to store local script files in EBCDIC.
130
-
They may be unreadable on the controller, but they will copy over to UNIX System Services targets,
131
-
be read in correctly in EBCDIC, and the script will run. This approach takes advantage of the built-in conveniences of the script module,
132
-
but storing unreadable files locally makes maintaining those script files difficult.
130
+
Another work-around is to store local script files in EBCDIC.
131
+
They may be unreadable on the controller, but they will copy correctly to z/OS UNIX System Services targets in EBCDIC,
132
+
and the script will run. This approach takes advantage of the built-in conveniences of the script module,
133
+
but managing unreadable EBCDIC files locally makes maintaining those script files difficult.
133
134
134
135
Configure the Remote Environment
135
-
-----------------------------------
136
+
--------------------------------
136
137
137
-
Certain Language Environment (LE) configurations enable automatic encoding conversion and automatic file tagging functionality required by python on z/OS systems.
138
+
Certain Language Environment (LE) configurations enable automatic encoding conversion and automatic file tagging functionality required by Python on z/OS systems (IBM Open Enterprise SDK for Python).
138
139
139
140
Include the following configurations when setting the remote environment for any z/OS managed nodes. (group_vars, host_vars, playbook, or task):
140
141
@@ -148,7 +149,7 @@ Include the following configurations when setting the remote environment for any
148
149
_TAG_REDIR_OUT: "txt"
149
150
150
151
151
-
Note, the remote environment can be set any of these levels:
152
+
Note, the remote environment can be set in any of these options:
152
153
153
154
* inventory - inventory.yml, group_vars/all.yml, or host_vars/all.yml
154
155
* playbook - ``environment`` variable at top of playbook.
@@ -157,14 +158,14 @@ Note, the remote environment can be set any of these levels:
157
158
For more details, see :ref:`playbooks_environment`.
158
159
159
160
Configure the Remote Python Interpreter
160
-
----------------------------------------
161
+
---------------------------------------
161
162
162
-
Ansible requires a python interpreter to run most modules on the remote host, and it checks for python at the ‘default’ path ``/usr/bin/python``.
163
+
Ansible requires a Python interpreter to run most modules on the remote host, and it checks for python at the 'default' path ``/usr/bin/python``.
163
164
164
165
On z/OS, the python3 interpreter (from `IBM Open Enterprise SDK for Python <https://www.ibm.com/products/open-enterprise-python-zos>`_)
165
166
is often installed to a different path, typically something like: ``/usr/lpp/cyp/v3r12/pyz``.
166
167
167
-
This path to the python interpreter can be configured with the Ansible inventory variable ``ansible_python_interpreter``.
168
+
The path to the Python interpreter can be configured with the Ansible inventory variable ``ansible_python_interpreter``.
168
169
For example:
169
170
170
171
.. code-block:: ini
@@ -192,22 +193,22 @@ Enable Ansible Pipelining
192
193
Enable :ref:`ANSIBLE_PIPELINING` in the ansible.cfg file.
193
194
194
195
When Ansible pipelining is enabled, Ansible passes any module code to the remote target node
195
-
through python's stdin pipe and runs it in all in a single call rather than copying data to temporary files first and then reading from those files.
196
+
through Python's stdin pipe and runs it in all in a single call rather than copying data to temporary files first and then reading from those files.
196
197
For more details on pipelining, see: :ref:`flow_pipelining`.
197
198
198
-
Enabling this behavior is encouraged because python will tag its pipes with the proper encoding, so there is less chance of encountering encoding errors.
199
-
Further, using python stdin pipes is more performant than file I/O.
199
+
Enabling this behavior is encouraged because Python will tag its pipes with the proper encoding, so there is less chance of encountering encoding errors.
200
+
Further, using Python stdin pipes is more performant than file I/O.
200
201
201
202
202
-
Include the following in the environment for any tasks performed on z/OS target nodes.
203
-
The value should be the encoding used by the z/OS UNIX shell on the remote target.
203
+
Include the following in the environment for any tasks performed on z/OS managed nodes.
204
+
The value should be the encoding used by the z/OS UNIX System Services managed node.
204
205
205
206
.. code-block:: yaml
206
207
207
208
PYTHONSTDINENCODING: "cp1047"
208
209
209
210
When Ansible pipelining is enabled but the ``PYTHONSTDINENCODING`` property is not correctly set, the following error may result.
210
-
Note, the ``'\x81'`` below may vary based on the target user and host:
211
+
Note, the hex ``'\x81'`` below may vary depending source causing the error:
211
212
212
213
.. code-block::
213
214
@@ -231,9 +232,9 @@ Using z/OS as a Control Node
231
232
----------------------------
232
233
233
234
The z/OS operating system currently cannot be configured to run as an Ansible control node.
234
-
Despite being POSIX-compliant, the UNIX System Services interface also cannot be configured to run as an Ansible control node.
235
+
Despite being POSIX-compliant, z/OS UNIX System Services interface also cannot be configured to run as an Ansible control node.
235
236
236
-
There are some options available on the IBM Z platform to set up as a control node:
237
+
There are options available on the IBM Z platform to use it as a control node:
Copy file name to clipboardExpand all lines: docs/docsite/rst/reference_appendices/faq.rst
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -328,9 +328,9 @@ Running on z/OS
328
328
.. error::
329
329
/usr/bin/python: FSUM7351 not found
330
330
331
-
Ansible requires a python interpreter to execute modules on the remote host, and checks for it at the ‘default’ path ``/usr/bin/python``.
331
+
Ansible requires a Python interpreter to execute modules on the remote host, and checks for it at the 'default' path ``/usr/bin/python``.
332
332
333
-
|On z/OS, the Python 3 interpreter (from `IBM Open Enterprise SDK for Python <https://www.ibm.com/products/open-enterprise-python-zos>`_) is often installed to a different path, typically something like:
333
+
|On z/OS, the Python 3 interpreter (from `IBM Open Enterprise SDK for Python <https://www.ibm.com/products/open-enterprise-python-zos>`_) is often installed to a different path, typically something like:
334
334
|``<path-to-python>/usr/lpp/cyp/v3r12/pyz``.
335
335
336
336
The path to the python interpreter can be configured with the Ansible inventory variable ``ansible_python_interpreter``.
@@ -347,21 +347,21 @@ Running on z/OS
347
347
.. error::
348
348
SyntaxError: Non-UTF-8 code starting with '\\x81' in file <stdin> on line 1, but no encoding declared; see https://peps.python.org/pep-0263/ for details
349
349
350
-
Note, the ``'\x81'`` below may vary based on the target user and host:
350
+
Note, the hex ``'\x81'`` below may vary depending source causing the error:
351
351
352
-
When Ansible pipelining is enabled, Ansible passes all module code to the remote target through python's stdin pipe and runs it all in a single call.
352
+
When Ansible pipelining is enabled, Ansible passes all module code to the remote target through Python's stdin pipe and runs it all in a single call.
353
353
For more details on pipelining, see: :ref:`flow_pipelining`.
354
354
355
-
Include the following in the remote environment configuration for any tasks performed on z/OS target nodes.
356
-
The value should be the local encoding used by the z/OS UNIX Systems Services shell of the remote target.
355
+
Include the following in the environment for any tasks performed on z/OS managed nodes.
356
+
The value should be the encoding used by the z/OS UNIX System Services managed node.
357
357
358
358
.. code-block:: yaml
359
359
360
360
PYTHONSTDINENCODING: "cp1047"
361
361
362
362
363
363
364
-
* Certain language environment (LE) configurations enable auto conversion and file tagging functionality required by python on z/OS systems.
364
+
* Certain language environment (LE) configurations enable auto conversion and file tagging functionality required by Python on z/OS systems (IBM Open Enterprise SDK for Python).
365
365
366
366
Include the following configurations when setting the remote environment for any z/OS managed nodes. (group_vars, host_vars, playbook, or task):
367
367
@@ -375,7 +375,7 @@ Running on z/OS
375
375
_TAG_REDIR_OUT: "txt"
376
376
377
377
378
-
Note, the remote environment can be set any of these levels: inventory (inventory.yml, group_vars, or host_vars), play, block, or task with the ``environment`` key word.
378
+
Note, the remote environment can be set in any of these options: inventory (inventory.yml, group_vars, or host_vars), play, block, or task with the ``environment`` key word.
0 commit comments