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?
Set up virtualenv¶After you install virtualenv, you can create a “virtual environment” to host your local copy of Ansible. This command creates a directory called myansible in your current working directory. This directory contains a copy of Python that will install modules in the myansible directory.
Home directory. /etc/ansible/ansible. cfg.
You can use the Ansible Python API to control nodes, you can extend Ansible to respond to various Python events, you can write plugins, and you can plug in inventory data from external data sources. This document gives a basic overview and examples of the Ansible execution and playbook API.
Ansible will automatically detect and use Python 3 on many platforms that ship with it. To explicitly configure a Python 3 interpreter, set the ansible_python_interpreter inventory variable at a group or host level to the location of a Python 3 interpreter, such as /usr/bin/python3.
You could also try chaining commands together.
- name: chained shell command
shell: "source /path/to/env/bin/activate; python setup.py develop"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With