
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
78 lines
2.5 KiB
YAML
78 lines
2.5 KiB
YAML
---
|
|
# Copyright (c) 2018 Red Hat, Inc.
|
|
#
|
|
# This file is part of ARA Records Ansible.
|
|
#
|
|
# ARA is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# ARA is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
- name: Install required dependencies
|
|
become: true
|
|
package:
|
|
name: "{{ required_packages }}"
|
|
state: "present"
|
|
|
|
# Debian/Ubuntu has a package for python-pip, RHEL and CentOS do not.
|
|
# TODO: Fedora actually has a package for python-pip.
|
|
- name: Install pip for Red Hat distributions
|
|
become: true
|
|
easy_install:
|
|
name: pip
|
|
state: present
|
|
|
|
# Need to make sure setuptools is up to date
|
|
- name: Initialize virtualenv with up-to-date setuptools
|
|
become: true
|
|
pip:
|
|
name: setuptools
|
|
state: latest
|
|
virtualenv: "{{ ara.install.pip.virtualenv_path }}"
|
|
when: ara.install.pip.virtualenv | bool
|
|
|
|
- name: Install ARA with pip
|
|
become: true
|
|
vars:
|
|
# Manage that the 'version' argument doesn't work when installing from source
|
|
pkg_name: |
|
|
{%- if ara.install.pip.method == 'source' and ara.install.pip.version -%}
|
|
{{- ara.install.pip.source }}@{{ ara.install.pip.version | default('master') -}}
|
|
{%- else -%}
|
|
ara
|
|
{%- endif -%}
|
|
pip:
|
|
name: "{{ pkg_name }}"
|
|
version: "{{ ara.install.pip.version | default(omit, True) }}"
|
|
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 }}"
|
|
when: ara.install.pip.virtualenv | bool
|