I am learning ansible.
I want to install virtual environment and install cassandra-driver inside venv. Could some one suggest me how to do that?
here is the code I have tried.
- hosts: localhost
gather_facts: no
connection: local
name: install cassendra-driver
become: true
become_user: root
tasks:
- name: Install the latest version of pip
apt:
name: python-pip
state: latest
force_apt_get: yes
- name: Install virtualenv
pip:
name:
- virtualenv
- name: Install "cassandra-driver"
pip:
name:
- cassandra-driver==3.19.0
Please help me..
There are two issues with your playbook:
This should fix your issues:
tasks:
- name: Manually create the initial virtualenv
command: python3 -m venv env
- name: Install "cassandra-driver"
command: env/bin/python -m pip install cassandra-driver