-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a new section for managing z/OS UNIX mainframe hosts with Ansible. #2424
base: devel
Are you sure you want to change the base?
Conversation
Signed-off-by: Ketan Kelkar <[email protected]>
Signed-off-by: Ketan Kelkar <[email protected]>
Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ketankelkar for pulling this into a new PR. Looks good to me.
docs/docsite/rst/os_guide/index.rst
Outdated
Using Ansible on Windows and BSD | ||
################################ | ||
####################################### | ||
Using Ansible on Windows, BSD, and z/OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it explicitly say z/OS UNIX here? Confusing z/OS with z/OS UNIX was one of the big issues in https://forum.ansible.com/t/40091 after all.
.. _working_with_zos: | ||
|
||
|
||
Managing z/OS hosts with Ansible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -316,41 +316,69 @@ is likely the problem. There are several workarounds: | |||
Running on z/OS | |||
--------------- | |||
|
|||
There are a few common errors that one might run into when trying to execute Ansible on z/OS as a target. | |||
* Generally speaking, z/OS cannot be used as an Ansible control node. For more details, see :ref:`zos_as_control_node`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in this section, shouldn't it explicitly say z/OS UNIX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this one, I actually wanted to capture the broader "z/OS" umbrella as being overall ineligible as a control node. This is our (ibm_zos_core collection team's) most frequently asked question.
That being said, I'm ok changing this to z/OS UNIX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both is fine for me, as long as using z/OS here instead of z/OS UNIX is intentional :)
Configure the Remote Python Interpreter | ||
--------------------------------------- | ||
|
||
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``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be either (if you mean Python, the programming language)
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``. | |
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``. |
or (if you mean python
, the CLI program)
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``. | |
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``. |
Same below in several other instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some documentation style guide edits and some questions...
z/OS which are aware of tags will use them. | ||
|
||
|
||
Using Ansible Community Modules with z/OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this applies to all modules in the community package (aka community.general, etc etc) or only to the core ansible.builtin modules. if it's just the ansible.builtin modules, please change the heading to "Using ansible.buitlin
moduels with z/OS UNIX" (note we use sentence case for headings in the Ansible docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I was wrongly equating "community" with "builtin"
…ances of 'Python' Signed-off-by: Ketan Kelkar <[email protected]>
…ate section headers to use sentence-case Signed-off-by: Ketan Kelkar <[email protected]>
Signed-off-by: Ketan Kelkar <[email protected]>
Thanks @felixfontein and @samccann for the reviews, I have updated the PR with the suggested changes, please have a look, which leads me to my next question: What practice does the community follow for resolving comments? Would you prefer I mark them 'resolved' as I add changes or is it better to have the comment author resolve them after having a chance to verify the changes? From what I can see from other PRs, seems like it's a mix of both - the creator of the PR and the commenter resolves comments |
Yeah it's a mix of both really. My preference - if the fix is obvious and you basically do it, I'm fine if you mark it resolved. Those of us who can merge will look for approvals and a quick scann of open comments to see if anything looks like it wasn't adressed before we hit the button. To clarify here the debate a bit on the forum - after this PR merges, one of use will go in and exclude it from the core docs. It will show up where you expect to see it on docs.ansible.com, but not on the core versioned docs for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one last nit to fix, but LGTM
Co-authored-by: Sandra McCann <[email protected]>
Here are some notes / pro-tips when using the ``ansible.builtin`` modules with z/OS UNIX. This is by no means a comprehensive list. | ||
Before using any Ansible modules, you must first :ref:`configure_zos_remote_environment`. | ||
|
||
* ansible.builtin.command / ansible.builtin.shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd link to the modules in question:
* ansible.builtin.command / ansible.builtin.shell | |
* :ansplugin:`ansible.builtin.command#module` / :ansplugin:`ansible.builtin.shell#module` |
Then users can quickly navigate to the module docs by clicking on the names, instead of having to search for them.
ansible.builtin.shell: "some_pgm | iconv -f ibm-1047 -t iso8859-1" | ||
|
||
|
||
* ansible.builtin.raw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ansible.builtin.raw | |
* :ansplugin:`ansible.builtin.raw#module` |
which set up the configured remote environment for each task. | ||
|
||
|
||
* ansible.builtin.copy / ansible.builtin.fetch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ansible.builtin.copy / ansible.builtin.fetch | |
* :ansplugin:`ansible.builtin.copy#module` / :ansplugin:`ansible.builtin.fetch#module` |
- name: Tag my_file.txt as UTF-8. | ||
ansible.builtin.command: chtag -tc iso8859-1 my_file.txt | ||
|
||
* ansible.builtin.blockinfile / ansible.builtin.lineinfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ansible.builtin.blockinfile / ansible.builtin.lineinfile | |
* :ansplugin:`ansible.builtin.blockinfile` / :ansplugin:`ansible.builtin.lineinfile` |
* ansible.builtin.blockinfile / ansible.builtin.lineinfile | ||
These modules process all data in UTF-8. Ensure target files are UTF-8 encoded beforehand and re-tag the files afterwards. | ||
|
||
* ansible.builtin.script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ansible.builtin.script | |
* :ansplugin:`ansible.builtin.script` |
The LE environment variable configurations will correctly convert streams if they are tagged and return readable output to Ansible. | ||
However, some command line programs may return output in UTF-8 and not tag the pipe. | ||
In this case, the autoconversion may incorrectly assume output is in EBCDIC and attempt to convert it and yield unreadable data. | ||
If the source encoding is known, you can use the ``ansible.builtin.shell`` module's capability to chain commands together through pipes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the source encoding is known, you can use the ``ansible.builtin.shell`` module's capability to chain commands together through pipes, | |
If the source encoding is known, you can use the :ansplugin:`ansible.builtin.shell#module` module's capability to chain commands together through pipes, |
|
||
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. | ||
Data sent to remote z/OS UNIX hosts through Ansible is, by default, encoded in UTF-8 and not tagged. | ||
Tagging a file is achievable with an additional task using the ``ansible.builtin.command`` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tagging a file is achievable with an additional task using the ``ansible.builtin.command`` module. | |
Tagging a file is achievable with an additional task using the :ansplugin:`ansible.builtin.command#module` module. |
When Ansible pipelining is enabled but the ``PYTHONSTDINENCODING`` property is not correctly set, the following error may result. | ||
Note, the hex ``'\x81'`` below may vary depending on the source causing the error: | ||
|
||
.. code-block:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All code-blocks should have a language:
.. code-block:: | |
.. code-block:: text |
the script file, since the file does not get tagged as UTF-8 text, the shell assumes that the file is encoded in EBCDIC, | ||
and fails to correctly read or run the script. | ||
One work-around is to manually copy local files to managed nodes (``ansible.builtin.copy`` ) and convert or tag files (with the ``ansible.builtin.command`` module). | ||
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, | |
With this work-around, some of the conveniences of the script module are lost, such as automatically cleaning up the script file once it is run, |
(https://docs.ansible.com/ansible/devel/dev_guide/style_guide/grammar_punctuation.html#contractions)
``ansible.builtin`` modules will assume all textual data is UTF-8 encoded, while z/OS UNIX may be using EBCDIC. | ||
On many z/OS UNIX systems, the default encoding for untagged files is EBCDIC. | ||
This variation in default settings can easily lead to data being misinterpreted with the wrong encoding, | ||
whether that's failing to auto convert EBCDIC to UTF-8 or erroneously attempting to convert data that is already in UTF-8. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether that's failing to auto convert EBCDIC to UTF-8 or erroneously attempting to convert data that is already in UTF-8. | |
whether that is failing to auto convert EBCDIC to UTF-8 or erroneously attempting to convert data that is already in UTF-8. |
Signed-off-by: Ketan Kelkar <[email protected]>
Signed-off-by: Ketan Kelkar <[email protected]>
Signed-off-by: Ketan Kelkar <[email protected]>
@felixfontein - thanks for the suggestion to add links to the modules! this will def make things more convenient for users / readers, plus it was very cool to learn about the |
This is a recreate of draft PR #2387 with a clean commit log.
From #2387 description:
A discussion in the Ansible Community Forum on this topic can be found: here