How to run python setup.py develop command inside virtualenv using ansible

I want to execute python setup.py develop command inside of virtualenv using ansible.
How to do it?

Probably could be something like this:

`

  • name: egg
    shell: “python setup.py develop”

`

But I need to execute it inside of virtualenv. How can I do it?

You can specify the path to the virtualenv’s python, e.g.,

shell: “/opt/venv/bin/python setup.py develop”

Or you could “source /opt/venv/bin/activate && python setup.py develop”

I usually have a var like virtualenv_path or virtualenv_python.

–michael