nickjj / ansible-docker

Install / Configure Docker and Docker Compose using Ansible.
MIT License
750 stars 224 forks source link

How to properly use virtualenv? #92

Closed 123unix closed 4 years ago

123unix commented 4 years ago

After installing docker with this role I have to use virtualenv with Ansible docker_* modules by specifying ansible_python_interpreter: '/usr/bin/env python-docker'

That's fine, but that conflicts with all other Ansible modules used in the same role or playbook, e.g. apt - they are inaccessible from the docker virtualenv.

As far as I understand, ansible_python_interpreter can only be set on a per-playbook basis.

What is the solution for this?

Thanks!

nickjj commented 4 years ago

Hi,

I'm using it in this task and it works: https://github.com/nickjj/ansible-docker/blob/master/tasks/main.yml#L135

Have you tried that?

nickjj commented 4 years ago

Closing this due to inactivity.