I am trying to run a virtual environment in Ansible.
It is constantly erroring out.
Here's the code:
- name: Install virtualenv
pip: name=virtualenv
when: virtualenvexists.stat.exists != true
- name: Create virtualenv
sudo: true
command: virtualenv /home/vagrant/db/venv
- name: Activate
sudo: yes
sudo_user: vagrant
command: /home/vagrant/db/venv/bin/source /home/vagrant/db/venv/bin/activate
I get the error message:
{"cmd": "/home/vagrant/db/venv/bin/activate", "failed": true, "rc": 13} msg: [Errno 13] Permission denied
I've tried running this command as multiple users, and I'm also trying to figure out how to automatically run commands from the virtual instance without activating it, and I'm having no luck.
How do I run commands inside a virtual environment in Ansible?
I've also tried this with no luck:
- name: ansible_python_interpreter
set_fact:
ansible_python_interpreter: /home/vagrant/db/venv/bin/python