Automatically install pymysql or psycopg2 if necessary
If a user is supplying a pymysql or psycopg2 connection string, the necessary driver needs to be installed before it can be used. Change-Id: I4655c9a39fea6a43f7e579f099d61836577202f0
This commit is contained in:
parent
c51366f722
commit
5eaafe1030
@ -35,6 +35,7 @@ ara:
|
||||
# Defaults to the latest version on PyPi or the master branch when installing from source
|
||||
version:
|
||||
config:
|
||||
# If pymysql or psycopg2 are found in the connection string, the role will install the necessary driver
|
||||
database: "sqlite:////var/lib/ara/ansible.sqlite"
|
||||
# Host to listen on for embedded server, apache or nginx
|
||||
host: 127.0.0.1
|
||||
|
@ -55,6 +55,22 @@
|
||||
state: present
|
||||
virtualenv: "{{ ara.install.pip.virtualenv | bool | ternary(ara.install.pip.virtualenv_path, omit) }}"
|
||||
|
||||
- name: Install pymysql with pip
|
||||
become: true
|
||||
pip:
|
||||
name: pymysql
|
||||
state: present
|
||||
virtualenv: "{{ ara.install.pip.virtualenv | bool | ternary(ara.install.pip.virtualenv_path, omit) }}"
|
||||
when: '"pymysql" in ara.config.database'
|
||||
|
||||
- name: Install psycopg2 with pip
|
||||
become: true
|
||||
pip:
|
||||
name: psycopg2
|
||||
state: present
|
||||
virtualenv: "{{ ara.install.pip.virtualenv | bool | ternary(ara.install.pip.virtualenv_path, omit) }}"
|
||||
when: '"psycopg2" in ara.config.database'
|
||||
|
||||
- name: Suffix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ara.install.pip.virtualenv_path }}/bin:{{ ansible_env.PATH }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user