Skip to content

MODULE FAILURE: No start of json char found on macOS and aarch64 Linux #1115

@basictheprogram

Description

@basictheprogram
SUMMARY

Migrating from ansible-core-2.12 to ansible-core-2.18.7 on macOS. Basic molecule tests using ansible_connection: docker and apt fail.

The problem seams to be macOS specific or ARM specific. The same tests succeed on AMD64 Linux.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

I suspect community.docker.plugins.connection.docker.py

ANSIBLE VERSION
$ ansible --version
ansible [core 2.18.7]
  config file = /workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vscode/.venv/lib/python3.13/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections:/workspace/collections
  executable location = /home/vscode/.venv/bin/ansible
  python version = 3.13.6 (main, Aug  8 2025, 17:10:04) [Clang 20.1.4 ] (/home/vscode/.venv/bin/python)
  jinja version = 3.1.6
  libyaml = True

macOS

$ sw_vers 
ProductName:		macOS
ProductVersion:		15.6
BuildVersion:		24G84

python

$ python -V
Python 3.13.6

Docker

$ docker --version
Docker version 28.3.3-1, build 980b85681696fbd95927fd8ded8f6d91bdca95b0

docker desktop
4.44.0 (201307)
COLLECTION VERSION
$ ansible-galaxy collection list community.docker

# /home/vscode/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.docker 4.7.0  

# /home/vscode/.venv/lib/python3.13/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 4.6.1  

# /workspace/collections/ansible_collections
Collection       Version
---------------- -------
community.docker 4.7.0  
CONFIGURATION
$ ansible-config dump --only-changed
ANSIBLE_PIPELINING(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = False
COLLECTIONS_PATHS(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = ['/home/vscode/.ansible/collections', '/usr/sh>
CONFIG_FILE() = /workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg
DEFAULT_DEBUG(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = False
DEFAULT_REMOTE_USER(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = ['/home/vscode/.ansible/roles', '/usr/share/a>
DEPRECATION_WARNINGS(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = True
RETRY_FILES_ENABLED(/workspace/collections/ansible_collections/realtime/logging/roles/alloy/ansible.cfg) = False
OS / ENVIRONMENT
Ubuntu 22.04.5 LTS

$ uname -a
Linux jammy 6.10.14-linuxkit #1 SMP Sat May 17 08:28:57 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
STEPS TO REPRODUCE

hosts.yml

    docker_containers:
      hosts:
        jammy:
          ansible_connection: docker

test-docker-connection.yml

---
- name: Testing
  hosts: all
  gather_facts: false
  become: true

  tasks:
    - name: Package update (apt)
      ansible.builtin.apt:
        update_cache: true
EXPECTED RESULTS
ansible-playbook [core 2.18.7]
  config file = /workspace/sites/real-time.com/ansible.cfg
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vscode/.venv/lib/python3.13/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections:/workspace/collections
  executable location = /home/vscode/.venv/bin/ansible-playbook
  python version = 3.13.6 (main, Aug  8 2025, 17:08:22) [Clang 20.1.4 ] (/home/vscode/.venv/bin/python)
  jinja version = 3.1.6
  libyaml = True
Using /workspace/sites/real-time.com/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /workspace/sites/real-time.com/testing/hosts.yml as it did not pass its verify_file() method
script declined parsing /workspace/sites/real-time.com/testing/hosts.yml as it did not pass its verify_file() method
Parsed /workspace/sites/real-time.com/testing/hosts.yml inventory source with yaml plugin
Loading callback plugin default of type stdout, v2.0 from /home/vscode/.venv/lib/python3.13/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: test-docker-connection.yml *****************************************************************************************************************************************************************
Positional arguments: playbooks/test-docker-connection.yml
verbosity: 4
remote_user: root
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/workspace/sites/real-time.com/testing/hosts.yml',)
subset: jammy
forks: 5
1 plays in playbooks/test-docker-connection.yml

PLAY [Testing] ***************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************
task path: /workspace/sites/real-time.com/playbooks/test-docker-connection.yml:2
redirecting (type: connection) ansible.builtin.docker to community.docker.docker
Loading collection community.docker from /workspace/collections/ansible_collections/community/docker
<jammy> ESTABLISH DOCKER CONNECTION FOR USER: root
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'echo ~root && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768 `" && echo ansible-tmp-1755032528.1298847-10631-1985867414768="` echo /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768 `" ) && sleep 0\'']
Using module file /home/vscode/.venv/lib/python3.13/site-packages/ansible/modules/setup.py
<jammy> PUT /home/vscode/.ansible/tmp/ansible-local-10625uvmvq25c/tmpjbbnq5_x TO /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768/AnsiballZ_setup.py
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'chmod u+rwx /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768/ /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768/AnsiballZ_setup.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768/AnsiballZ_setup.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1755032528.1298847-10631-1985867414768/ > /dev/null 2>&1 && sleep 0'"]
ok: [jammy]

TASK [Package update (apt)] **************************************************************************************************************************************************************************
task path: /workspace/sites/real-time.com/playbooks/test-docker-connection.yml:13
redirecting (type: connection) ansible.builtin.docker to community.docker.docker
Loading collection community.docker from /workspace/collections/ansible_collections/community/docker
<jammy> ESTABLISH DOCKER CONNECTION FOR USER: root
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'echo ~root && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603 `" && echo ansible-tmp-1755032529.8738043-10730-39478951980603="` echo /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603 `" ) && sleep 0\'']
Using module file /home/vscode/.venv/lib/python3.13/site-packages/ansible/modules/apt.py
<jammy> PUT /home/vscode/.ansible/tmp/ansible-local-10625uvmvq25c/tmp8nlh1mhi TO /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603/AnsiballZ_apt.py
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'chmod u+rwx /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603/ /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603/AnsiballZ_apt.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603/AnsiballZ_apt.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1755032529.8738043-10730-39478951980603/ > /dev/null 2>&1 && sleep 0'"]
ok: [jammy] => {
    "cache_update_time": 1755030556,
    "cache_updated": false,
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_change_held_packages": false,
            "allow_downgrade": false,
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "clean": false,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "fail_on_autoremove": false,
            "force": false,
            "force_apt_get": false,
            "install_recommends": null,
            "lock_timeout": 60,
            "only_upgrade": false,
            "package": null,
            "policy_rc_d": null,
            "purge": false,
            "state": "present",
            "update_cache": true,
            "update_cache_retries": 5,
            "update_cache_retry_max_delay": 12,
            "upgrade": null
        }
    }
}

PLAY RECAP *******************************************************************************************************************************************************************************************
jammy                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
ACTUAL RESULTS
$ ansible-playbook -i hosts.yml  -u root test-docker-connection.yml -vvvv
ansible-playbook [core 2.18.7]
  config file = /workspace/sites/real-time.com/ansible.cfg
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vscode/.venv/lib/python3.13/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections:/workspace/collections
  executable location = /home/vscode/.venv/bin/ansible-playbook
  python version = 3.13.6 (main, Aug  8 2025, 17:10:04) [Clang 20.1.4 ] (/home/vscode/.venv/bin/python)
  jinja version = 3.1.6
  libyaml = True
Using /workspace/sites/real-time.com/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /workspace/sites/real-time.com/testing/hosts.yml as it did not pass its verify_file() method
Parsed /workspace/sites/real-time.com/testing/hosts.yml inventory source with yaml plugin
Loading callback plugin default of type stdout, v2.0 from /home/vscode/.venv/lib/python3.13/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: test-docker-connection.yml *******************************************************************************************************************
Positional arguments: playbooks/test-docker-connection.yml
verbosity: 4
remote_user: root
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/workspace/sites/real-time.com/testing/hosts.yml',)
subset: jammy
forks: 5
1 plays in playbooks/test-docker-connection.yml

PLAY [Testing] *****************************************************************************************************************************************

TASK [Package update (apt)] ****************************************************************************************************************************
task path: /workspace/sites/real-time.com/playbooks/test-docker-connection.yml:13
redirecting (type: connection) ansible.builtin.docker to community.docker.docker
Loading collection community.docker from /workspace/collections/ansible_collections/community/docker
<jammy> ESTABLISH DOCKER CONNECTION FOR USER: root
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'echo ~root && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782 `" && echo ansible-tmp-1755032388.6888099-5035-90015542539782="` echo /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782 `" ) && sleep 0\'']
Using module file /home/vscode/.venv/lib/python3.13/site-packages/ansible/modules/apt.py
<jammy> PUT /home/vscode/.ansible/tmp/ansible-local-502988q4_v__/tmpu7hkqbi6 TO /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782/AnsiballZ_apt.py
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'chmod u+rwx /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782/ /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782/AnsiballZ_apt.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782/AnsiballZ_apt.py && sleep 0'"]
<jammy> EXEC ['/usr/bin/docker', b'exec', b'-u', 'root', b'-i', 'jammy', '/bin/sh', '-c', "/bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1755032388.6888099-5035-90015542539782/ > /dev/null 2>&1 && sleep 0'"]
fatal: [jammy]: FAILED! => {
    "changed": false,
    "module_stderr": "",
    "module_stdout": "",
    "msg": "MODULE FAILURE: No start of json char found\nSee stdout/stderr for the exact error",
    "rc": 0
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    third-party-bugThis is a bug in some other software, not in ours

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions