Skip to content

become_method: machinectl results in IndentationError: unexpected indent #81254

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

Closed
1 task done
Yannik opened this issue Jul 13, 2023 · 6 comments · May be fixed by #84878 or ansible-collections/community.general#9908
Closed
1 task done

Comments

@Yannik
Copy link
Contributor

Yannik commented Jul 13, 2023

Summary

Using become_method: machinectl results in failure when

[ssh_connection]
pipelining = True

is configured.

Issue Type

Bug Report

Component Name

become

Ansible Version

$ ansible --version
ansible [core 2.15.1]
  config file = /home/yannik/projects/mcc-berlin/ansible.cfg
  configured module search path = ['/home/yannik/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/yannik/.local/lib/python3.11/site-packages/ansible
  ansible collection location = /home/yannik/projects/mcc-berlin/vendor_collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.4 (main, Jun  7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = /home/yannik/projects/ansible/ansible.cfg
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less

CONNECTION:
==========

ssh:
___
pipelining(/home/yannik/projects/ansible/ansible.cfg) = True

OS / Environment

Target OS: Debian bookworm

Steps to Reproduce

Task:

- shell: echo $XDG_RUNTIME_DIR
  become: yes
  become_user: web-cpim
  become_method: machinectl

ansible.cfg:

[ssh_connection]
pipelining = True

Expected Results

The task should not fail

Actual Results

fatal: [host]: FAILED! => changed=false 
  module_stderr: ''
  module_stdout: |-
    Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> #!/usr/bin/python3
    >>> # -*- coding: utf-8 -*-
    >>> _ANSIBALLZ_WRAPPER = True # For test-module.py script to tell this is a ANSIBALLZ_WRAPPER
    >>> def _ansiballz_main():
    ...     import os
    ...     import os.path
    ...     try:
    ...         os.getcwd()
    ...     except OSError:
    ...         try:
    ...             os.chdir(os.path.expanduser('~'))
    ...         except OSError:
    ...             os.chdir('/')
    ...
    >>>     import sys
    l  File "<stdin>", line 1
        import sys
    IndentationError: unexpected indent
    >>>     import __main__
      File "<stdin>", line 1
        import __main__
    IndentationError: unexpected indent
    >>>     scriptdir = None
      File "<stdin>", line 1
        scriptdir = None
    IndentationError: unexpected indent
    >>>     try:
      File "<stdin>", line 1
        try:
    IndentationError: unexpected indent
    >>>         scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))
      File "<stdin>", line 1
        scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))
    IndentationError: unexpected indent
    >>>     except (AttributeError, OSError):
      File "<stdin>", line 1
        except (AttributeError, OSError):
    IndentationError: unexpected indent
    >>>         pass
      File "<stdin>", line 1
        pass
    IndentationError: unexpected indent
    >>>     excludes = set(('', '.', scriptdir))
      File "<stdin>", line 1
        excludes = set(('', '.', scriptdir))
    IndentationError: unexpected indent
    >>>     sys.path = [p for p in sys.path if p not in excludes]
      File "<stdin>", line 1
        sys.path = [p for p in sys.path if p not in excludes]
    IndentationError: unexpected indent
    >>>     import base64
      File "<stdin>", line 1
        import base64
    IndentationError: unexpected indent
    >>>     import runpy
      File "<stdin>", line 1
        import runpy
    IndentationError: unexpected indent
    >>>     import shutil
      File "<stdin>", line 1
        import shutil
    IndentationError: unexpected indent
    >>>     import tempfile
      File "<stdin>", line 1
        import tempfile
    IndentationError: unexpected indent
    >>>     import zipfile
      File "<stdin>", line 1
        import zipfile
    IndentationError: unexpected indent
    >>>     if sys.version_info < (3,):
      File "<stdin>", line 1
        if sys.version_info < (3,):
    IndentationError: unexpected indent
    >>>         PY3 = False
      File "<stdin>", line 1
        PY3 = False
    IndentationError: unexpected indent
    >>>     else:
      File "<stdin>", line 1
        else:
    IndentationError: unexpected indent
    >>>         PY3 = True
      File "<stdin>", line 1
        PY3 = True
    IndentationError: unexpected indent
    >>>     ZIPDATA = """<LONG-BASE64-TEXT>
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 0

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added needs_triage Needs a first human triage before being processed. affects_2.15 labels Jul 13, 2023
@ansibot
Copy link
Contributor

ansibot commented Jul 13, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@mattclay
Copy link
Member

@Yannik It looks like you're using pipelining with a TTY over SSH, which isn't supported. Do you have a custom ssh configuration forcing the use of a TTY for the connection?

@mattclay mattclay added needs_info This issue requires further information. Please answer any outstanding questions. and removed needs_triage Needs a first human triage before being processed. labels Jul 13, 2023
@Yannik
Copy link
Contributor Author

Yannik commented Jul 13, 2023

Hi @mattclay,

no, as far as I am aware, that is not the case.

To make sure there is nothing weird going on, I have created a completely fresh ansible project with only the following files:

hosts
ansible.cfg
run.yml

Here is the content of each file:

hosts:

ariadne ansible_host=myhost.com ansible_user=root ansible_port=22

run.yml:

- hosts: ariadne
  tasks:
    - shell: echo $XDG_RUNTIME_DIR
      become: yes
      become_user: web-cpim
      become_method: machinectl

ansible.cfg:

[ssh_connection]
pipelining = True

Additionally, I have confirmed that there is no special ~/.ssh/config for this host.

Here is the full output of ansible-playbook -i hosts run.yml -vvvv:

ansible-playbook [core 2.15.1]
  config file = /home/yannik/projects/machinectl-test/ansible.cfg
  configured module search path = ['/home/yannik/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/yannik/.local/lib/python3.11/site-packages/ansible
  ansible collection location = /home/yannik/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.11.4 (main, Jun  7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
Using /home/yannik/projects/machinectl-test/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /home/yannik/projects/machinectl-test/hosts as it did not pass its verify_file() method
script declined parsing /home/yannik/projects/machinectl-test/hosts as it did not pass its verify_file() method
auto declined parsing /home/yannik/projects/machinectl-test/hosts as it did not pass its verify_file() method
Parsed /home/yannik/projects/machinectl-test/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /home/yannik/.local/lib/python3.11/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: run.yml ***********************************************************************************************************************************
Positional arguments: run.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/yannik/projects/machinectl-test/hosts',)
forks: 5
1 plays in run.yml

PLAY [ariadne] **************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
task path: /home/yannik/projects/machinectl-test/run.yml:1
<ariadne> Attempting python interpreter discovery
<myhost.com> ESTABLISH SSH CONNECTION FOR USER: root
<myhost.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/yannik/.ansible/cp/2c5c97d0f8"' myhost.com '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.11'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.10'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<myhost.com> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3.11\n/usr/bin/python3\nENDFOUND\n', b"OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<myhost.com> ESTABLISH SSH CONNECTION FOR USER: root
<myhost.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/yannik/.ansible/cp/2c5c97d0f8"' myhost.com '/bin/sh -c '"'"'/usr/bin/python3.11 && sleep 0'"'"''
<myhost.com> (0, b'{"platform_dist_result": [], "osrelease_content": "PRETTY_NAME=\\"Debian GNU/Linux 12 (bookworm)\\"\\nNAME=\\"Debian GNU/Linux\\"\\nVERSION_ID=\\"12\\"\\nVERSION=\\"12 (bookworm)\\"\\nVERSION_CODENAME=bookworm\\nID=debian\\nHOME_URL=\\"https://www.debian.org/\\"\\nSUPPORT_URL=\\"https://www.debian.org/support\\"\\nBUG_REPORT_URL=\\"https://bugs.debian.org/\\"\\n"}\n', b"OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
Using module file /home/yannik/.local/lib/python3.11/site-packages/ansible/modules/setup.py
Pipelining is enabled.
<myhost.com> ESTABLISH SSH CONNECTION FOR USER: root
<myhost.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/yannik/.ansible/cp/2c5c97d0f8"' myhost.com '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
<myhost.com> (0, b'\n{"ansible_facts": {"ansible_user_id": "root", "ansible_user_uid": 0, "ansible_user_gid": 0, "ansible_user_gecos": "root", "ansible_user_dir": "/root", "ansible_user_shell": "/bin/bash", "ansible_real_user_id": 0, "ansible_effective_user_id": 0, "ansible_real_group_id": 0, "ansible_effective_group_id": 0, "ansible_virtualization_role": "guest", "ansible_virtualization_type": "kvm", "ansible_virtualization_tech_guest": ["kvm"], "ansible_virtualization_tech_host": ["kvm"], "ansible_cmdline": {"BOOT_IMAGE": "/vmlinuz-5.10.0-23-amd64", "root": "/dev/mapper/ariadne--vg-root", "ro": true, "quiet": true}, "ansible_proc_cmdline": {"BOOT_IMAGE": "/vmlinuz-5.10.0-23-amd64", "root": "/dev/mapper/ariadne--vg-root", "ro": true, "quiet": true}, "ansible_system_capabilities_enforced": "False", "ansible_system_capabilities": [], "ansible_env": {"LANGUAGE": "en_US:en", "USER": "root", "SSH_CLIENT": "93.237.124.245 43416 22", "XDG_SESSION_TYPE": "tty", "SHLVL": "0", "MOTD_SHOWN": "pam", "HOME": "/root", "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/0/bus", "LOGNAME": "root", "_": "/bin/sh", "XDG_SESSION_CLASS": "user", "XDG_SESSION_ID": "858", "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "XDG_RUNTIME_DIR": "/run/user/0", "LANG": "en_US.UTF-8", "SHELL": "/bin/bash", "PWD": "/root", "SSH_CONNECTION": "93.237.124.245 43416 45.83.104.253 22"}, "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCzNVqGE/qdiTN81wEuqChTZYqZCoUjlBoAR7yxtUo+SzRxSRc1tscGP4B18rTCMa73CL2XkdDezTDcfQfJQSGFy1Huw2IZ4dPpN18wjU3qDkv7NUD0pNFrpCKGTo9JIxxvqaENUoMNW0tEtSjeeyDcXMaKSzpEGwjYvBI2H4Kzt9BqlsDG3E8t5u0ef2uwpnwisRqAxNW+nGjm2RNlZ8RVOFaEoRZQp7NUJFkw8zU+Gi2MJ5hK4rkyLdZwPdZuBlFFJGJ6LokNPsAk1sZWmrXPQru6ENZrbgmoH5ZIu8xNAhUFWc6jPPjuKneuaG0VxcBr34ritDnOX3gcueEePsy1", "ansible_ssh_host_key_rsa_public_keytype": "ssh-rsa", "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSHn75ffSZEVKgKxwRIFI2jxRVB96LOrtA/6Mt5QykXvC6SVznK3N6WrJ+O7TYw+K4s4Fg0gh6Zb2CCIhWbdnQ=", "ansible_ssh_host_key_ecdsa_public_keytype": "ecdsa-sha2-nistp256", "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAICfWBdAu7we6hkeJx4ns6x/zqxCyz8pgbPawoYQSs6SI", "ansible_ssh_host_key_ed25519_public_keytype": "ssh-ed25519", "ansible_system": "Linux", "ansible_kernel": "6.1.0-10-amd64", "ansible_kernel_version": "#1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03)", "ansible_machine": "x86_64", "ansible_python_version": "3.11.2", "ansible_fqdn": "ariadne", "ansible_hostname": "ariadne", "ansible_nodename": "ariadne", "ansible_domain": "", "ansible_userspace_bits": "64", "ansible_architecture": "x86_64", "ansible_userspace_architecture": "x86_64", "ansible_machine_id": "1a09ac7d21d44d8da81c3a9e0e26f405", "ansible_hostnqn": "", "ansible_selinux_python_present": true, "ansible_selinux": {"status": "disabled"}, "ansible_date_time": {"year": "2023", "month": "07", "weekday": "Thursday", "weekday_number": "4", "weeknumber": "28", "day": "13", "hour": "20", "minute": "09", "second": "30", "epoch": "1689271770", "epoch_int": "1689271770", "date": "2023-07-13", "time": "20:09:30", "iso8601_micro": "2023-07-13T18:09:30.733510Z", "iso8601": "2023-07-13T18:09:30Z", "iso8601_basic": "20230713T200930733510", "iso8601_basic_short": "20230713T200930", "tz": "CEST", "tz_dst": "CEST", "tz_offset": "+0200"}, "ansible_distribution": "Debian", "ansible_distribution_release": "bookworm", "ansible_distribution_version": "12.0", "ansible_distribution_major_version": "12", "ansible_distribution_file_path": "/etc/os-release", "ansible_distribution_file_variety": "Debian", "ansible_distribution_file_parsed": true, "ansible_distribution_minor_version": "0", "ansible_os_family": "Debian", "ansible_dns": {"nameservers": ["46.38.225.230", "46.38.252.230"]}, "ansible_local": {}, "ansible_apparmor": {"status": "enabled"}, "ansible_is_chroot": false, "ansible_loadavg": {"1m": 0.07763671875, "5m": 0.0888671875, "15m": 0.0380859375}, "ansible_fibre_channel_wwn": [], "ansible_fips": false, "ansible_lsb": {"id": "Debian", "description": "Debian GNU/Linux 12 (bookworm)", "release": "12", "codename": "bookworm", "major_release": "12"}, "ansible_processor": ["0", "AuthenticAMD", "AMD EPYC 7702P 64-Core Processor", "1", "AuthenticAMD", "AMD EPYC 7702P 64-Core Processor", "2", "AuthenticAMD", "AMD EPYC 7702P 64-Core Processor", "3", "AuthenticAMD", "AMD EPYC 7702P 64-Core Processor"], "ansible_processor_count": 1, "ansible_processor_cores": 4, "ansible_processor_threads_per_core": 1, "ansible_processor_vcpus": 4, "ansible_processor_nproc": 4, "ansible_memtotal_mb": 15993, "ansible_memfree_mb": 11426, "ansible_swaptotal_mb": 16379, "ansible_swapfree_mb": 16379, "ansible_memory_mb": {"real": {"total": 15993, "used": 4567, "free": 11426}, "nocache": {"free": 14069, "used": 1924}, "swap": {"total": 16379, "free": 16379, "used": 0, "cached": 0}}, "ansible_bios_date": "12/09/2020", "ansible_bios_vendor": "netcup", "ansible_bios_version": "RS 2000 G9", "ansible_board_asset_tag": "NA", "ansible_board_name": "NA", "ansible_board_serial": "NA", "ansible_board_vendor": "NA", "ansible_board_version": "NA", "ansible_chassis_asset_tag": "NA", "ansible_chassis_serial": "NA", "ansible_chassis_vendor": "QEMU", "ansible_chassis_version": "pc-i440fx-4.2", "ansible_form_factor": "Other", "ansible_product_name": "KVM Server", "ansible_product_serial": "NA", "ansible_product_uuid": "1a09ac7d-21d4-4d8d-a81c-3a9e0e26f405", "ansible_product_version": "RS 2000 G9", "ansible_system_vendor": "netcup", "ansible_devices": {"loop1": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "dm-1": {"virtual": 1, "links": {"ids": ["dm-name-ariadne--vg-root", "dm-uuid-LVM-uwxcztROKFXWElej7R6HdHqiZK7GjM8RI4gwVZPI6Ve1KOdGtNfmni2VvE3qZCzP"], "uuids": ["08112061-e9c4-4072-ba2f-73719dd4b5bd"], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "", "sectors": "200818688", "sectorsize": "512", "size": "95.76 GB", "host": "", "holders": []}, "loop6": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "loop4": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "sr0": {"virtual": 1, "links": {"ids": ["ata-QEMU_DVD-ROM_QM00003"], "uuids": [], "labels": [], "masters": []}, "vendor": "QEMU", "model": "QEMU DVD-ROM", "sas_address": null, "sas_device_handle": null, "removable": "1", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "mq-deadline", "sectors": "2097151", "sectorsize": "512", "size": "1024.00 MB", "host": "IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]", "holders": []}, "loop2": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "dm-2": {"virtual": 1, "links": {"ids": ["dm-name-ariadne--vg-swap_1", "dm-uuid-LVM-uwxcztROKFXWElej7R6HdHqiZK7GjM8RMl0tbmAGp3cMLuPRKvFuwasQC24NGiDh"], "uuids": ["b6b6a24c-8c76-4cd7-a393-9b7995eef028"], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "", "sectors": "33546240", "sectorsize": "512", "size": "16.00 GB", "host": "", "holders": []}, "loop0": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "dm-0": {"virtual": 1, "links": {"ids": ["dm-name-sda5_crypt", "dm-uuid-CRYPT-LUKS2-66f0c6702e714777b4c4685ba6941c34-sda5_crypt", "lvm-pv-uuid-6mH01N-PxFh-sxPn-lRer-Rj2w-wQCd-51Jh1N"], "uuids": [], "labels": [], "masters": ["dm-1", "dm-2"]}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "", "sectors": "670552064", "sectorsize": "512", "size": "319.74 GB", "host": "", "holders": ["ariadne--vg-root", "ariadne--vg-swap_1"]}, "loop7": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "sda": {"virtual": 1, "links": {"ids": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0"], "uuids": [], "labels": [], "masters": []}, "vendor": "QEMU", "model": "QEMU HARDDISK", "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "4096", "partitions": {"sda2": {"links": {"ids": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part2"], "uuids": [], "labels": [], "masters": []}, "start": "501758", "sectors": "2", "sectorsize": 512, "size": "1.00 KB", "uuid": null, "holders": []}, "sda5": {"links": {"ids": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part5"], "uuids": ["66f0c670-2e71-4777-b4c4-685ba6941c34"], "labels": [], "masters": ["dm-0"]}, "start": "501760", "sectors": "670584832", "sectorsize": 512, "size": "319.76 GB", "uuid": "66f0c670-2e71-4777-b4c4-685ba6941c34", "holders": ["sda5_crypt"]}, "sda1": {"links": {"ids": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part1"], "uuids": ["d54010ef-2c0e-441a-87c7-7d0fd575d732"], "labels": [], "masters": []}, "start": "2048", "sectors": "497664", "sectorsize": 512, "size": "243.00 MB", "uuid": "d54010ef-2c0e-441a-87c7-7d0fd575d732", "holders": []}}, "rotational": "1", "scheduler_mode": "none", "sectors": "671088640", "sectorsize": "512", "size": "320.00 GB", "host": "SCSI storage controller: Red Hat, Inc. Virtio SCSI", "holders": []}, "loop5": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}, "loop3": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {}, "rotational": "1", "scheduler_mode": "none", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "host": "", "holders": []}}, "ansible_device_links": {"ids": {"sr0": ["ata-QEMU_DVD-ROM_QM00003"], "sda1": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part1"], "sda2": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part2"], "sda5": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0-part5"], "sda": ["scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0"], "dm-0": ["dm-name-sda5_crypt", "dm-uuid-CRYPT-LUKS2-66f0c6702e714777b4c4685ba6941c34-sda5_crypt", "lvm-pv-uuid-6mH01N-PxFh-sxPn-lRer-Rj2w-wQCd-51Jh1N"], "dm-2": ["dm-name-ariadne--vg-swap_1", "dm-uuid-LVM-uwxcztROKFXWElej7R6HdHqiZK7GjM8RMl0tbmAGp3cMLuPRKvFuwasQC24NGiDh"], "dm-1": ["dm-name-ariadne--vg-root", "dm-uuid-LVM-uwxcztROKFXWElej7R6HdHqiZK7GjM8RI4gwVZPI6Ve1KOdGtNfmni2VvE3qZCzP"]}, "uuids": {"sda1": ["d54010ef-2c0e-441a-87c7-7d0fd575d732"], "sda5": ["66f0c670-2e71-4777-b4c4-685ba6941c34"], "dm-2": ["b6b6a24c-8c76-4cd7-a393-9b7995eef028"], "dm-1": ["08112061-e9c4-4072-ba2f-73719dd4b5bd"]}, "labels": {}, "masters": {"dm-0": ["dm-1", "dm-2"], "sda5": ["dm-0"]}}, "ansible_uptime_seconds": 580168, "ansible_lvm": {"lvs": {"root": {"size_g": "95.76", "vg": "ariadne-vg"}, "swap_1": {"size_g": "16.00", "vg": "ariadne-vg"}}, "vgs": {"ariadne-vg": {"size_g": "319.74", "free_g": "207.99", "num_lvs": "2", "num_pvs": "1"}}, "pvs": {"/dev/mapper/sda5_crypt": {"size_g": "319.74", "free_g": "207.99", "vg": "ariadne-vg"}}}, "ansible_mounts": [{"mount": "/", "device": "/dev/mapper/ariadne--vg-root", "fstype": "ext4", "options": "rw,relatime,errors=remount-ro", "size_total": 100603785216, "size_available": 82145951744, "block_size": 4096, "block_total": 24561471, "block_available": 20055164, "block_used": 4506307, "inode_total": 6283264, "inode_available": 6184128, "inode_used": 99136, "uuid": "08112061-e9c4-4072-ba2f-73719dd4b5bd"}, {"mount": "/boot", "device": "/dev/sda1", "fstype": "ext2", "options": "rw,relatime", "size_total": 244658176, "size_available": 132830208, "block_size": 1024, "block_total": 238924, "block_available": 129717, "block_used": 109207, "inode_total": 62248, "inode_available": 61892, "inode_used": 356, "uuid": "d54010ef-2c0e-441a-87c7-7d0fd575d732"}], "ansible_interfaces": ["ens3", "docker0", "lo"], "ansible_docker0": {"device": "docker0", "macaddress": "02:42:01:01:c9:88", "mtu": 1500, "active": false, "type": "bridge", "interfaces": [], "id": "8000.02420101c988", "stp": false, "speed": -1, "promisc": false, "ipv4": {"address": "172.17.0.1", "broadcast": "172.17.255.255", "netmask": "255.255.0.0", "network": "172.17.0.0", "prefix": "16"}}, "ansible_ens3": {"device": "ens3", "macaddress": "b6:19:43:00:98:8d", "mtu": 1500, "active": true, "module": "virtio_net", "type": "ether", "pciid": "virtio0", "speed": -1, "promisc": false, "ipv4": {"address": "45.83.104.253", "broadcast": "45.83.107.255", "netmask": "255.255.252.0", "network": "45.83.104.0", "prefix": "22"}, "ipv6": [{"address": "fe80::b419:43ff:fe00:988d", "prefix": "64", "scope": "link"}]}, "ansible_lo": {"device": "lo", "mtu": 65536, "active": true, "type": "loopback", "promisc": false, "ipv4": {"address": "127.0.0.1", "broadcast": "", "netmask": "255.0.0.0", "network": "127.0.0.0", "prefix": "8"}, "ipv6": [{"address": "::1", "prefix": "128", "scope": "host"}]}, "ansible_default_ipv4": {"gateway": "45.83.104.1", "interface": "ens3", "address": "45.83.104.253", "broadcast": "45.83.107.255", "netmask": "255.255.252.0", "network": "45.83.104.0", "prefix": "22", "macaddress": "b6:19:43:00:98:8d", "mtu": 1500, "type": "ether", "alias": "ens3"}, "ansible_default_ipv6": {"gateway": "fe80::1", "interface": "ens3", "address": "fe80::b419:43ff:fe00:988d", "prefix": "64", "scope": "link", "macaddress": "b6:19:43:00:98:8d", "mtu": 1500, "type": "ether"}, "ansible_all_ipv4_addresses": ["172.17.0.1", "45.83.104.253"], "ansible_all_ipv6_addresses": ["fe80::b419:43ff:fe00:988d"], "ansible_locally_reachable_ips": {"ipv4": ["45.83.104.253", "127.0.0.0/8", "127.0.0.1", "172.17.0.1"], "ipv6": ["::1", "fe80::b419:43ff:fe00:988d"]}, "ansible_iscsi_iqn": "", "ansible_python": {"version": {"major": 3, "minor": 11, "micro": 2, "releaselevel": "final", "serial": 0}, "version_info": [3, 11, 2, "final", 0], "executable": "/usr/bin/python3", "has_sslcontext": true, "type": "cpython"}, "ansible_pkg_mgr": "apt", "ansible_service_mgr": "systemd", "gather_subset": ["all"], "module_setup": true}, "invocation": {"module_args": {"gather_subset": ["all"], "gather_timeout": 10, "filter": [], "fact_path": "/etc/ansible/facts.d"}}}\n', b"OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
ok: [ariadne]

TASK [shell] ****************************************************************************************************************************************
task path: /home/yannik/projects/machinectl-test/run.yml:3
redirecting (type: become) ansible.builtin.machinectl to community.general.machinectl
Loading collection community.general from /usr/share/ansible/collections/ansible_collections/community/general
Using module file /home/yannik/.local/lib/python3.11/site-packages/ansible/modules/command.py
Pipelining is enabled.
<myhost.com> ESTABLISH SSH CONNECTION FOR USER: root
<myhost.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/yannik/.ansible/cp/2c5c97d0f8"' myhost.com '/bin/sh -c '"'"'machinectl -q shell  web-cpim@ /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-fbriusenhsbetywdbjcmufxroptvxylt ; /usr/bin/python3'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<myhost.com> (0, b'Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux\r\nType "help", "copyright", "credits" or "license" for more information.\r\n>>> #!/usr/bin/python3\r\n>>> # -*- coding: utf-8 -*-\r\n>>> _ANSIBALLZ_WRAPPER = True # For test-module.py script to tell this is a ANSIBALLZ_WRAPPER\r\n>>> def _ansiballz_main():\r\n...     import os\r\n...     import os.path\r\n4n...     try:\r\n...         os.getcwd()\r\n...     except OSError:\r\n...         try:\r\n...             os.chdir(os.path.expanduser(\'~\'))\r\n...         except OSError:\r\nL...             os.chdir(\'/\')\r\n... \r\n>>>     import sys\r\n  File "<stdin>", line 1\r\n    import sys\r\nIndentationError: unexpected indent\r\n>>>     import __main__\r\n  File "<stdin>", line 1\r\n    import __main__\r\nIndentationError: unexpected indent\r\n>>>     scriptdir = None\r\nCdj/VY/k  File "<stdin>", line 1\r\n    scriptdir = None\r\nIndentationError: unexpected indent\r\n>>>     try:\r\nr  File "<stdin>", line 1\r\n    try:\r\nIndentationError: unexpected indent\r\n>>>         scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\n  File "<stdin>", line 1\r\n    scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\nIndentationError: unexpected indent\r\n>>>     except (AttributeError, OSError):\r\n  File "<stdin>", line 1\r\n    except (AttributeError, OSError):\r\nIndentationError: unexpected indent\r\n>>>         pass\r\n  File "<stdin>", line 1\r\n    pass\r\nIndentationError: unexpected indent\r\n>>>     excludes = set((\'\', \'.\', scriptdir))\r\n  File "<stdin>", line 1\r\n    excludes = set((\'\', \'.\', scriptdir))\r\nIndentationError: unexpected indent\r\n>>>     sys.path = [p for p in sys.path if p not in excludes]\r\n  File "<stdin>", line 1\r\n    sys.path = [p for p in sys.path if p not in excludes]\r\nIndentationError: unexpected indent\r\n>>>     import base64\r\nM  File "<stdin>", line 1\r\n    import base64\r\nIndentationError: unexpected indent\r\n>>>     import runpy\r\n1TQW  File "<stdin>", line 1\r\n    import runpy\r\nIndentationError: unexpected indent\r\n>>>     import shutil\r\nql  File "<stdin>", line 1\r\n    import shutil\r\nIndentationError: unexpected indent\r\n>>>     import tempfile\r\n  File "<stdin>", line 1\r\n    import tempfile\r\nIndentationError: unexpected indent\r\n>>>     import zipfile\r\n  File "<stdin>", line 1\r\n    import zipfile\r\nIndentationError: unexpected indent\r\n>>>     if sys.version_info < (3,):\r\nJ  File "<stdin>", line 1\r\n    if sys.version_info < (3,):\r\nIndentationError: unexpected indent\r\n>>>         PY3 = False\r\nA  File "<stdin>", line 1\r\n    PY3 = False\r\nIndentationError: unexpected indent\r\n>>>     else:\r\n  File "<stdin>", line 1\r\n    else:\r\nIndentationError: unexpected indent\r\n>>>         PY3 = True\r\n  File "<stdin>", line 1\r\n    PY3 = True\r\nIndentationError: unexpected indent\r\n>>> \n', b"OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
fatal: [ariadne]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n",
    "module_stdout": "Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> #!/usr/bin/python3\r\n>>> # -*- coding: utf-8 -*-\r\n>>> _ANSIBALLZ_WRAPPER = True # For test-module.py script to tell this is a ANSIBALLZ_WRAPPER\r\n>>> def _ansiballz_main():\r\n...     import os\r\n...     import os.path\r\n4n...     try:\r\n...         os.getcwd()\r\n...     except OSError:\r\n...         try:\r\n...             os.chdir(os.path.expanduser('~'))\r\n...         except OSError:\r\nL...             os.chdir('/')\r\n... \r\n>>>     import sys\r\n  File \"<stdin>\", line 1\r\n    import sys\r\nIndentationError: unexpected indent\r\n>>>     import __main__\r\n  File \"<stdin>\", line 1\r\n    import __main__\r\nIndentationError: unexpected indent\r\n>>>     scriptdir = None\r\nCdj/VY/k  File \"<stdin>\", line 1\r\n    scriptdir = None\r\nIndentationError: unexpected indent\r\n>>>     try:\r\nr  File \"<stdin>\", line 1\r\n    try:\r\nIndentationError: unexpected indent\r\n>>>         scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\n  File \"<stdin>\", line 1\r\n    scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\nIndentationError: unexpected indent\r\n>>>     except (AttributeError, OSError):\r\n  File \"<stdin>\", line 1\r\n    except (AttributeError, OSError):\r\nIndentationError: unexpected indent\r\n>>>         pass\r\n  File \"<stdin>\", line 1\r\n    pass\r\nIndentationError: unexpected indent\r\n>>>     excludes = set(('', '.', scriptdir))\r\n  File \"<stdin>\", line 1\r\n    excludes = set(('', '.', scriptdir))\r\nIndentationError: unexpected indent\r\n>>>     sys.path = [p for p in sys.path if p not in excludes]\r\n  File \"<stdin>\", line 1\r\n    sys.path = [p for p in sys.path if p not in excludes]\r\nIndentationError: unexpected indent\r\n>>>     import base64\r\nM  File \"<stdin>\", line 1\r\n    import base64\r\nIndentationError: unexpected indent\r\n>>>     import runpy\r\n1TQW  File \"<stdin>\", line 1\r\n    import runpy\r\nIndentationError: unexpected indent\r\n>>>     import shutil\r\nql  File \"<stdin>\", line 1\r\n    import shutil\r\nIndentationError: unexpected indent\r\n>>>     import tempfile\r\n  File \"<stdin>\", line 1\r\n    import tempfile\r\nIndentationError: unexpected indent\r\n>>>     import zipfile\r\n  File \"<stdin>\", line 1\r\n    import zipfile\r\nIndentationError: unexpected indent\r\n>>>     if sys.version_info < (3,):\r\nJ  File \"<stdin>\", line 1\r\n    if sys.version_info < (3,):\r\nIndentationError: unexpected indent\r\n>>>         PY3 = False\r\nA  File \"<stdin>\", line 1\r\n    PY3 = False\r\nIndentationError: unexpected indent\r\n>>>     else:\r\n  File \"<stdin>\", line 1\r\n    else:\r\nIndentationError: unexpected indent\r\n>>>         PY3 = True\r\n  File \"<stdin>\", line 1\r\n    PY3 = True\r\nIndentationError: unexpected indent\r\n>>> \n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 0
}

PLAY RECAP ******************************************************************************************************************************************
ariadne                    : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Jul 13, 2023
@mattclay
Copy link
Member

It looks like a TTY is being used after become completes:

<myhost.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/yannik/.ansible/cp/2c5c97d0f8"' myhost.com '/bin/sh -c '"'"'machinectl -q shell  web-cpim@ /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-fbriusenhsbetywdbjcmufxroptvxylt ; /usr/bin/python3'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<myhost.com> (0, b'Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux\r\nType "help", "copyright", "credits" or "license" for more information.\r\n>>> #!/usr/bin/python3\r\n>>> # -*- coding: utf-8 -*-\r\n>>> _ANSIBALLZ_WRAPPER = True # For test-module.py script to tell this is a ANSIBALLZ_WRAPPER\r\n>>> def _ansiballz_main():\r\n...     import os\r\n...     import os.path\r\n4n...     try:\r\n...         os.getcwd()\r\n...     except OSError:\r\n...         try:\r\n...             os.chdir(os.path.expanduser(\'~\'))\r\n...         except OSError:\r\nL...             os.chdir(\'/\')\r\n... \r\n>>>     import sys\r\n  File "<stdin>", line 1\r\n    import sys\r\nIndentationError: unexpected indent\r\n>>>     import __main__\r\n  File "<stdin>", line 1\r\n    import __main__\r\nIndentationError: unexpected indent\r\n>>>     scriptdir = None\r\nCdj/VY/k  File "<stdin>", line 1\r\n    scriptdir = None\r\nIndentationError: unexpected indent\r\n>>>     try:\r\nr  File "<stdin>", line 1\r\n    try:\r\nIndentationError: unexpected indent\r\n>>>         scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\n  File "<stdin>", line 1\r\n    scriptdir = os.path.dirname(os.path.realpath(__main__.__file__))\r\nIndentationError: unexpected indent\r\n>>>     except (AttributeError, OSError):\r\n  File "<stdin>", line 1\r\n    except (AttributeError, OSError):\r\nIndentationError: unexpected indent\r\n>>>         pass\r\n  File "<stdin>", line 1\r\n    pass\r\nIndentationError: unexpected indent\r\n>>>     excludes = set((\'\', \'.\', scriptdir))\r\n  File "<stdin>", line 1\r\n    excludes = set((\'\', \'.\', scriptdir))\r\nIndentationError: unexpected indent\r\n>>>     sys.path = [p for p in sys.path if p not in excludes]\r\n  File "<stdin>", line 1\r\n    sys.path = [p for p in sys.path if p not in excludes]\r\nIndentationError: unexpected indent\r\n>>>     import base64\r\nM  File "<stdin>", line 1\r\n    import base64\r\nIndentationError: unexpected indent\r\n>>>     import runpy\r\n1TQW  File "<stdin>", line 1\r\n    import runpy\r\nIndentationError: unexpected indent\r\n>>>     import shutil\r\nql  File "<stdin>", line 1\r\n    import shutil\r\nIndentationError: unexpected indent\r\n>>>     import tempfile\r\n  File "<stdin>", line 1\r\n    import tempfile\r\nIndentationError: unexpected indent\r\n>>>     import zipfile\r\n  File "<stdin>", line 1\r\n    import zipfile\r\nIndentationError: unexpected indent\r\n>>>     if sys.version_info < (3,):\r\nJ  File "<stdin>", line 1\r\n    if sys.version_info < (3,):\r\nIndentationError: unexpected indent\r\n>>>         PY3 = False\r\nA  File "<stdin>", line 1\r\n    PY3 = False\r\nIndentationError: unexpected indent\r\n>>>     else:\r\n  File "<stdin>", line 1\r\n    else:\r\nIndentationError: unexpected indent\r\n>>>         PY3 = True\r\n  File "<stdin>", line 1\r\n    PY3 = True\r\nIndentationError: unexpected indent\r\n>>> \n', b"OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /home/yannik/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 55: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf\r\ndebug2: checking match for 'final all' host myhost.com originally myhost.com\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512]\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/yannik/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/yannik/.ssh/known_hosts2'\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 600278\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")

Notice how Python is going into the REPL after the Escalation succeeded message is shown. It looks like machinectl is creating a TTY. You'll need to disable pipelining for the affected task(s).

For further discussion you may want to open an issue in the community.general collection, where the machinectl become plugin now resides: https://github.com/ansible-collections/community.general/

@Yannik
Copy link
Contributor Author

Yannik commented Jul 13, 2023

Hi @mattclay,
thanks for the input.

How can pipelining be disabled for a single task?

@Yannik
Copy link
Contributor Author

Yannik commented Jul 13, 2023

...like this:

      vars:
        ansible_ssh_pipelining: no

works fine!

For me, this resolves the issue. Feel free to close this as you see fit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants