ansible-collections / ibm_zos_core

Red Hat Ansible Certified Content for IBM Z
75 stars 44 forks source link

[Bug][ansible.builtin.shell] Non UTF-8 encoded data running a ls command with become_user #1487

Closed gngrossi closed 2 months ago

gngrossi commented 2 months ago

Is there an existing issue for this?

Bug description

Trying to use become_user and run an ls command. The su command worked (confirmed in the the z/OS syslog).

IBM z/OS Ansible core Version

v1.9.0

IBM Z Open Automation Utilities

v1.2.5 (default)

IBM Enterprise Python

v3.11.x (default)

ansible-version

v2.16.x (default)

z/OS version

v2.5 (default)

Ansible module

No response

Playbook verbosity output.

vars: ansible_remote_tmp: "/tmp" CMD00: "ls /tmp" USR01: "MQUSSADM"

tasks:

Escalation succeeded

(0, b"\x8e#\x82\xc4\xc7/>\xc5\xc1\xc0\x82\x9a\x80\xc8\xca\xcd\xc1\x8c\x80\x82\xcb\xc8\xc0?\xcd\xc8\x82\x9a\x80\x82\x07\xc8_\xf8\x82\x8c\x80\x82\xcb\xc8\xc0\xc1\xca\xca\x82\x9a\x80\x82\x82\x8c\x80\x82\xca\xc4\x82\x9a\x80\x90\x8c\x80\x82\xc4_\xc0\x82\x9a\x80\x82%\xcb\x80\x07\xc8_\xf8\x82\x8c\x80\x82\xcb\xc8/\xca\xc8\x82\x9a\x80\x82\x16\x90\x16\x94\x05\x90\x94\x05\x16\x98\x80\x91\x16\x9a\x90\x93\x9a\x95\x94\x06\x04\x94\x99\x91\x95\x94\x82\x8c\x80\x82\xc1>\xc0\x82\x9a\x80\x82\x16\x90\x16\x94\x05\x90\x94\x05\x16\x98\x80\x91\x16\x9a\x90\x93\x9a\x95\x94\x06\x98\x90\x94\x04\x95\x90\x82\x8c\x80\x82\xc0\xc1%\xc8/\x82\x9a\x80\x82\x90\x9a\x90\x90\x9a\x90\x90\x06\x90\x95\x95\x95\x99\x96\x82\x8c\x80\x82_\xcb\xc5\x82\x9a\x80\x82\x82\x8c\x80\x82\xd1>\xce?\xc4/\xc8\xd1?>\x82\x9a\x80#\x82_?\xc0\xcd%\xc1^/\xca\xc5\xcb\x82\x9a\x80#\x82^\xca/\xcf^\xf8/\xca/_\xcb\x82\x9a\x80\x82%\xcb\x80\x07\xc8_\xf8\x82\x8c\x80\x82^\xcd\xcb\xc1\xcb^\xcb\xc7\xc1%%\x82\x9a\x80\xc8\xca\xcd\xc1\x8c\x80\x82\xc1\xcc\xf8/>\xc0^/\xca\xc5\xcd_\xc1>\xc8^\xce/\xca\xcb\x82\x9a\x80\xc8\xca\xcd\xc1\x8c\x80\x82\xcb\xc8\xc0\xd1>^/\xc0\xc0^>\xc1\xcf%\xd1>\xc1\x82\x9a\x80\xc8\xca\xcd\xc1\x8c\x80\x82\xcb\xc8\xca\xd1\xf8^\xc1_\xf8\xc8`^\xc1>\xc0\xcb\x82\x9a\x80\xc8\xca\xcd\xc1\x8c\x80\x82/\xca\xc5\xce\x82\x9a\x80>\xcd%%\x8c\x80\x82\xc4\xc7\xc0\xd1\xca\x82\x9a\x80>\xcd%%\x8c\x80\x82\xc1\xcc\xc1\xc4\xcd\xc8/\xc2%\xc1\x82\x9a\x80>\xcd%%\x8c\x80\x82\xc4\xca\xc1/\xc8\xc1\xcb\x82\x9a\x80>\xcd%%\x8c\x80\x82\xca\xc1_?\xce\xc1\xcb\x82\x9a\x80>\xcd%%\x8c\x80\x82\xcb\xc8\xc0\xd1>\x82\x9a\x80>\xcd%%'''\x8e", b'Shared connection to mvs-sysd closed.\r\n') ESTABLISH SSH CONNECTION FOR USER: @02858 SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="@02858"' -o ConnectTimeout=15 -o 'ControlPath="/home/me/.ansible/cp/b5b2dc9cb5"' mvs-sysd '/bin/sh -c '"'"'rm -f -r /tmp/ansible-tmp-1714323833.5791962-13648-30753762687926/ > /dev/null 2>&1 && sleep 0'"'"'' (0, b'', b'') [DEPRECATION WARNING]: Non UTF-8 encoded data replaced with "?" while displaying text to stdout/stderr, this is temporary and will become an error. This feature will be removed in version 2.18. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. fatal: [mvs-sysd]: FAILED! => { "changed": false, "module_stderr": "Shared connection to mvs-sysd closed.\r\n", "module_stdout": "?#?/>???Ȃ?\u0007?_?ʂ?Ă?_?%ˀ\u0007?_?/?Ȃ?\u0016?\u0016?\u0005?\u0005\u0016?\u0016?\u0006\u0004?>?\u0016?\u0016?\u0005?\u0005\u0016?\u0016?\u0006?\u0004?%?/?\u0006?_?ł?>???/??>?#?_??%?^/?˂?#?^?/?^?/?/_˂?%ˀ\u0007?_?^?^?%%?/>?^/?_?>?^?/?˂?>^/?^>?%?>?^?_?`^?>?˂?/?΂?>?%%?ʂ?>?%%?/?%?>?%%?/?˂?>?%%?_??˂?>?%%?>?>?%%'''?", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 0 } ### Ansible configuration. ```YAML [defaults] forks = 25 inventory = ~/playbooks/inventory.yml host_key_checking = False remote_port = 2222 timeout = 15 #deprecation_warnings = False [ssh_connection] pipelining = True ``` ### Contents of the inventory ```YAML MA1: hosts: mvs-sysd: ansible_python_interpreter: "env PYTHONSTDINENCODING=cp1047 \ /hewitt/zopentools/python311/usr/lpp/IBM/cyp/v3r11/pyz/bin/python3" vars: ansible_user: "@02858" ``` ### Contents of `group_vars` or `host_vars` _No response_
richp405 commented 2 months ago

We will switch this to a discussion, because it relates to Ansible community module, not to our specific product. We may be able to help with environment, or become user options.