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

Cannot delegate_to with connection: docker #76778

Closed
1 task done
singpolyma opened this issue Jan 17, 2022 · 6 comments
Closed
1 task done

Cannot delegate_to with connection: docker #76778

singpolyma opened this issue Jan 17, 2022 · 6 comments
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@singpolyma
Copy link

Summary

Trying to use delegate_to with connection: docker produces an error. Removing the delegate_to it works fine.

Issue Type

Bug Report

Component Name

delegate_to

Ansible Version

$ ansible --version

ansible 2.10.8
  config file = None
  configured module search path = ['/home/singpolyma/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]

Configuration

$ ansible-config dump --only-changed

OS / Environment

$ cat /etc/issue
Ubuntu 18.04.6 LTS \n \l

$ uname -a
Linux REDACTED 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Steps to Reproduce

- become: true
  hosts: all
  tasks:
  - apt:
      update_cache: true
  - command:
      cmd: echo hai
    delegate_to: "container-name"
    connection: docker

Expected Results

It should run a command inside a container.

Actual Results

UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo ~/.ansible/tmp/ansible-tmp-1642452724.8971472-123454-5127813474037 `\" && echo ansible-tmp-1642452724.8971472-123454-5127813474037=\"` echo ~/.ansible/tmp/ansible-tmp-1642452724.8971472-123454-5127813474037 `\" ), exited with result 1", "unreachable": true}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@bcoca
Copy link
Member

bcoca commented Jan 17, 2022

does the host you delegate to already have ansible_connection set?

@singpolyma
Copy link
Author

No, but I have realized that maybe it is trying to connect to docker on my local machine where I run ansible instead of the docker on the remote host, and maybe that's my issue? Using a non-existent container name gives me the same error.

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jan 17, 2022
@bcoca
Copy link
Member

bcoca commented Jan 17, 2022

the 'docker' connection plugin assumes the host running ansible contains the docker instances

@singpolyma
Copy link
Author

@bcoca Yeah, ok, it seems that's the problem. Not a very clear error message when the problem is "container not found" ...

@bcoca
Copy link
Member

bcoca commented Jan 17, 2022

The error is correct, the plugin does not handle remotes. In most cases this should reflect that the container is down/does not exist/is misspelled, not that it is running on the wrong host.

In any case, that plugin does not reside in this repo anymore https://github.com/ansible-collections/community.docker/issues

@singpolyma
Copy link
Author

Sure, just that "cannot create temporary directory" does not really indicate to me that the container is not found.

In any case, you're right that this is the wrong repo anyway. Sorry about that.

@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Jan 18, 2022
@ansible ansible locked and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

4 participants