Skip to content
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

Unable to init swarm #695

Closed
Hursofid opened this issue Oct 13, 2023 · 6 comments · Fixed by #696
Closed

Unable to init swarm #695

Hursofid opened this issue Oct 13, 2023 · 6 comments · Fixed by #696
Labels
bug Something isn't working docker-swarm Docker Swarm

Comments

@Hursofid
Copy link

Hursofid commented Oct 13, 2023

SUMMARY

Unable to init swarm with docker_swarm module:
TypeError: init_swarm() got an unexpected keyword argument 'data_path_addr'

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_swarm

ANSIBLE VERSION
ansible [core 2.15.4]
  config file = /home/constructed/Nextcloud/git/ansible-contabo/ansible.cfg
  configured module search path = ['/home/constructed/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/ansible
  ansible collection location = /home/constructed/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/linuxbrew/.linuxbrew/bin/ansible
  python version = 3.11.6 (main, Oct  2 2023, 13:45:54) [GCC 11.4.0] (/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/constructed/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.docker 3.4.8  

# /home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 3.4.8
CONFIGURATION
CONFIG_FILE() = /home/constructed/Nextcloud/git/ansible-<REDACTED>/ansible.cfg
DEFAULT_FORKS(/home/constructed/Nextcloud/git/ansible-<REDACTED>/ansible.cfg) = 20
DEFAULT_GATHERING(/home/constructed/Nextcloud/git/ansible-<REDACTED>/ansible.cfg) = smart
DEFAULT_HOST_LIST(/home/constructed/Nextcloud/git/ansible-<REDACTED>/ansible.cfg) = ['/home/constructed/Nextcloud/git/ansible-<redacted>/hosts.yml']
DEFAULT_VAULT_PASSWORD_FILE(/home/constructed/Nextcloud/git/ansible-<REDACTED>/ansible.cfg) = /home/constructed/Nextcloud/git/ansible-<<REDACTED>>/.vault_pass
EDITOR(env: EDITOR) = nano
INTERPRETER_PYTHON(/home/constructed/Nextcloud/git/ansible-<<REDACTED>>/ansible.cfg) = auto_legacy_silent
OS / ENVIRONMENT

Local Debian GNU/Linux 11 (bullseye) x86_64 Linux 5.10.0-26-amd64
Remote Debian GNU/Linux 10 (buster) x86_64 Linux 4.19.0-21-amd64
containerd --version
containerd containerd.io 1.6.24 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
pip3 show docker
Name: docker
Version: 3.4.1
docker -v
Docker version 24.0.6, build ed223bc

STEPS TO REPRODUCE

Run a minimal playbook with the task as described

- name: Ensure Swarm is running
  community.docker.docker_swarm:
    state: present
EXPECTED RESULTS
ACTUAL RESULTS

ansible-playbook swarm.yml does not initialize swarm on target machine (but I'm able to do so manually)

TASK [swarm : Ensure Swarm is running] *******************************************************************************************************************************************************************************************************
task path: /home/constructed/<REDACTED>/roles/swarm/tasks/01_swarm-cluster.yml:57
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' REDACTED_PUBLIC_IP_ADDR '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<REDACTED_PUBLIC_IP_ADDR> (0, b'/home/ansible\n', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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")
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' REDACTED_PUBLIC_IP_ADDR '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337 `" && echo ansible-tmp-1697206392.794571-58034-174459559314337="` echo /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337 `" ) && sleep 0'"'"''
<REDACTED_PUBLIC_IP_ADDR> (0, b'ansible-tmp-1697206392.794571-58034-174459559314337=/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337\n', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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/constructed/.ansible/collections/ansible_collections/community/docker/plugins/modules/docker_swarm.py
<REDACTED_PUBLIC_IP_ADDR> PUT /home/constructed/.ansible/tmp/ansible-local-57972n7cr3lyl/tmpvr7hqecj TO /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' REDACTED_PUBLIC_IP_ADDR 'dd of=/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py bs=65536'
<REDACTED_PUBLIC_IP_ADDR> (0, b'', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\n0+10 records in\n0+10 records out\n163026 bytes (163 kB, 159 KiB) copied, 0.0261736 s, 6.2 MB/s\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<REDACTED_PUBLIC_IP_ADDR> (0, b'', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\n0+10 records in\n0+10 records out\n163026 bytes (163 kB, 159 KiB) copied, 0.0261736 s, 6.2 MB/s\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' REDACTED_PUBLIC_IP_ADDR '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/ /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py && sleep 0'"'"''
<REDACTED_PUBLIC_IP_ADDR> (0, b'', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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")
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' -tt REDACTED_PUBLIC_IP_ADDR '/bin/sh -c '"'"'su  root -c '"'"'"'"'"'"'"'"'/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-pvvnwtmepccinigxdajlppqgyvhjlzlj ; /usr/bin/python3 /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<REDACTED_PUBLIC_IP_ADDR> (1, b'\r\nTraceback (most recent call last):\r\n  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 107, in <module>\r\n    _ansiballz_main()\r\n  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 48, in invoke_module\r\n    run_name=\'__main__\', alter_sys=True)\r\n  File "/usr/lib/python3.7/runpy.py", line 205, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 728, in <module>\r\n  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 717, in main\r\n  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 493, in __call__\r\n  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 548, in init_swarm\r\n  File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 34, in wrapper\r\n    return f(self, *args, **kwargs)\r\nTypeError: init_swarm() got an unexpected keyword argument \'data_path_addr\'\r\n', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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 1\r\nShared connection to REDACTED_PUBLIC_IP_ADDR closed.\r\n")
<REDACTED_PUBLIC_IP_ADDR> Failed to connect to the host via ssh: OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023
debug1: Reading configuration data /home/constructed/.ssh/config
debug1: /home/constructed/.ssh/config line 1: Applying options for *
debug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0
debug1: Reading configuration data /home/constructed/<REDACTED>.conf
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.ssh/known_hosts2'
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 57983
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1
Shared connection to REDACTED_PUBLIC_IP_ADDR closed.
<REDACTED_PUBLIC_IP_ADDR> ESTABLISH SSH CONNECTION FOR USER: ansible
<REDACTED_PUBLIC_IP_ADDR> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes -o Port=<REDACTED_SSH_PORT> -o 'IdentityFile="/home/constructed/.ssh/<REDACTED>.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/constructed/.ansible/cp/70b1c2549f"' REDACTED_PUBLIC_IP_ADDR '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/ > /dev/null 2>&1 && sleep 0'"'"''
<REDACTED_PUBLIC_IP_ADDR> (0, b'', b"OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config <truncated> Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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: [<REDACTED>]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_8.4p1 Debian-5+deb11u2, OpenSSL 1.1.1w  11 Sep 2023\r\ndebug1: Reading configuration data /home/constructed/.ssh/config\r\ndebug1: /home/constructed/.ssh/config line 1: Applying options for *\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/<REDACTED>.conf\r\ndebug3: /home/constructed/.ssh/config line 6: Including file /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf depth 0\r\ndebug1: Reading configuration data /home/constructed/Nextcloud/ssh/conf.d/<REDACTED>.conf\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname REDACTED_PUBLIC_IP_ADDR is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/constructed/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/constructed/.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 = 57983\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 1\r\nShared connection to REDACTED_PUBLIC_IP_ADDR closed.\r\n",
    "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py\", line 48, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib/python3.7/runpy.py\", line 205, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib/python3.7/runpy.py\", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py\", line 728, in <module>\r\n  File \"/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py\", line 717, in main\r\n  File \"/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py\", line 493, in __call__\r\n  File \"/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py\", line 548, in init_swarm\r\n  File \"/usr/lib/python3/dist-packages/docker/utils/decorators.py\", line 34, in wrapper\r\n    return f(self, *args, **kwargs)\r\nTypeError: init_swarm() got an unexpected keyword argument 'data_path_addr'\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

@felixfontein
Copy link
Collaborator

Traceback in readable form:

Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 107, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1697206392.794571-58034-174459559314337/AnsiballZ_docker_swarm.py", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 728, in <module>
  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 717, in main
  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 493, in __call__
  File "/tmp/ansible_community.docker.docker_swarm_payload_s52vf63h/ansible_community.docker.docker_swarm_payload.zip/ansible_collections/community/docker/plugins/modules/docker_swarm.py", line 548, in init_swarm
  File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 34, in wrapper
    return f(self, *args, **kwargs)
TypeError: init_swarm() got an unexpected keyword argument 'data_path_addr'

@felixfontein felixfontein added bug Something isn't working docker-swarm Docker Swarm labels Oct 13, 2023
@felixfontein
Copy link
Collaborator

Did you run pip3 show docker on the remote or on the controller? The interesting information is the value on the remote.

@Hursofid
Copy link
Author

Hursofid commented Oct 13, 2023

Hi, thanks for checking my issue.
Yes, all this information is related to remote:

Debian GNU/Linux 10 (buster) x86_64 Linux 4.19.0-21-amd64

# containerd --version
containerd containerd.io 1.6.24 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523

# pip3 show docker
Remote Debian GNU/Linux 10 (buster) x86_64 Linux 4.19.0-21-amd64
containerd --version
containerd containerd.io 1.6.24 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
pip3 show docker
Name: docker
Version: 3.4.1

# docker -v
Docker version 24.0.6, build ed223bc

@felixfontein
Copy link
Collaborator

Hmm, Docker SDK for Python 3.4.1 supports only very few options for init_swarm: https://github.com/docker/docker-py/blob/3.4.1/docker/api/swarm.py#L84-L85

It looks like the module incorrectly assumes that data_path_addr is one of them: https://github.com/ansible-collections/community.docker/blob/main/plugins/modules/docker_swarm.py#L537 That option was added in #344. Unfortunately nobody back then made sure that that option is actually supported by all versions of Docker SDK for Python that the module supports...

In any case, this should be pretty straightforward to fix, by handling it optionally (and adding it to option_minimal_versions) as some of the other options further below.

@felixfontein
Copy link
Collaborator

(According to the changelog, data_path_addr was added in Docker SDK for Python 4.0.0: https://docker-py.readthedocs.io/en/stable/change-log.html#id60, and according to the Docker SDK for Python code it requires API version 1.39 or newer.)

@Hursofid
Copy link
Author

Many thanks for pointing out, I've installed venv[1], updated $PATH and got latest docker module installed with python3 -m pip install docker:

# pip3 show docker
Name: docker
Version: 6.1.3

This fixed the issue and I'm able to initiate swarm with community.docker.docker_swarm module.
Hope it helps to someone else too :)

[1] Creating Virtual Environments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-swarm Docker Swarm
Projects
None yet
2 participants