diff --git a/defaults/main.yml b/defaults/main.yml index e3c46e0..640da16 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/install/pip.yml b/tasks/install/pip.yml index 7cb4c38..90bc987 100644 --- a/tasks/install/pip.yml +++ b/tasks/install/pip.yml @@ -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 }}"