On Apr 11, russell sherman wrote:
https://medium.com/dronzebot/ansible-and-docker-py-path-issues-and-resolv...
it seems i can work around this by setting python path in the environment
to point to the docker virtualenv
inventory__environment:
PYTHONPATH: "{{ lookup('env','PYTHONPATH')
}}:/usr/local/lib/docker/virtualenv/lib/python2.7/site-packages/"
this is very curious.. as hosts provisioned before today don't seem to need
this.. but today's host does..
On Thu, Apr 11, 2019 at 10:44 AM russell sherman <
russell.t.sherman(a)gmail.com> wrote:
> i'm having an issue with my debops project..
> i went to provision a new host today and i'm getting this error when any
> of my roles call docker_image tasks..
>
> fatal: [venue419.mgmt.union.up]: FAILED! => {"changed": false,
"msg":
> "Failed to import docker or docker-py - No module named
> requests.exceptions. Try `pip install docker` or `pip install docker-py`
> (Python 2.6)"}
>
> none of my existing hosts experience this error.. just the newest one..
>
> any suggestions around how to resolve this?
Not sure why it happens now. However, if you want to use Ansible 'docker_*'
modules with the 'debops.docker' virtualenv, the best way might be to specify
the 'ansible_python_interpreter' variable in the playbook. You either have to
do this only to playbooks with 'docker_*' tasks in them, or install the needed
Python modules needed by Ansible if you want to do anything else. This is
described in the 'debops.docker' documentation:
https://docs.debops.org/en/master/ansible/roles/debops.docker/docker-virt...
Let me know if that works.
Maciej