Add support for installing from source
This provides the ability to install from source either on the local filesystem or from pypi. Change-Id: I883bf88638d6d4de1965f1863a4c401e58ea0126
This commit is contained in:
parent
b526ed4c9a
commit
8857b3054c
|
@ -18,10 +18,23 @@
|
|||
|
||||
ara:
|
||||
params:
|
||||
# If ARA should be installed inside a virtualenv
|
||||
virtualenv: true
|
||||
# Location where the virtualenv should be installed
|
||||
virtualenv_path: /opt/ara-venv
|
||||
install:
|
||||
# The method used to install ARA ('pip' or 'distribution')
|
||||
method: pip
|
||||
pip:
|
||||
# If ARA should be installed inside a virtualenv
|
||||
virtualenv: true
|
||||
# Location where the virtualenv should be installed
|
||||
virtualenv_path: /opt/ara-venv
|
||||
# Method to install ARA with pip ('pypi' or 'source')
|
||||
method: pypi
|
||||
# When installing from source, location of the repository
|
||||
# When installing from a source on the filesystem, only specify the path to the repository
|
||||
source: git+https://git.openstack.org/openstack/ara
|
||||
# When installing from pypi, version to install (ex: '0.15.0')
|
||||
# When installing from source, ref to the commit, tag or branch to install
|
||||
# Defaults to the latest version on PyPi or the master branch when installing from source
|
||||
version:
|
||||
config:
|
||||
database: "sqlite:////var/lib/ara/ansible.sqlite"
|
||||
# Host to listen on for embedded server, apache or nginx
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
# 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.params.install.pip.virtualenv_path }}"
|
||||
when: ara.params.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.params.install.pip.method == 'source' -%}
|
||||
{{- ara.params.install.pip.source }}@{{ ara.params.install.pip.version | default('master') -}}
|
||||
{%- else -%}
|
||||
ara
|
||||
{%- endif -%}
|
||||
pip:
|
||||
name: "{{ pkg_name }}"
|
||||
version: "{{ ara.params.install.pip.version | default(omit, True) }}"
|
||||
state: present
|
||||
virtualenv: "{{ ara.params.install.pip.virtualenv | bool | ternary(ara.params.install.pip.virtualenv_path, omit) }}"
|
||||
|
||||
- name: Suffix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ara.params.install.pip.virtualenv_path }}/bin:{{ ansible_env.PATH }}"
|
||||
when: ara.params.install.pip.virtualenv | bool
|
|
@ -29,38 +29,8 @@
|
|||
- ara_override is defined
|
||||
- ara_override is mapping
|
||||
|
||||
- name: Install required dependencies
|
||||
become: true
|
||||
package:
|
||||
name: "{{ required_packages }}"
|
||||
state: "present"
|
||||
|
||||
- name: Install pip
|
||||
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.params.virtualenv_path }}"
|
||||
when: ara.params.virtualenv | bool
|
||||
|
||||
- name: Install ARA with pip
|
||||
become: true
|
||||
pip:
|
||||
name: ara
|
||||
state: present
|
||||
virtualenv: "{{ ara.params.virtualenv | bool | ternary(ara.params.virtualenv_path, omit) }}"
|
||||
|
||||
- name: Suffix the virtualenv bin directory to PATH
|
||||
set_fact:
|
||||
path_with_virtualenv: "{{ ara.params.virtualenv_path }}/bin:{{ ansible_env.PATH }}"
|
||||
when: ara.params.virtualenv | bool
|
||||
- name: Include ARA installation
|
||||
include_tasks: "install/{{ ara.params.install.method }}.yml"
|
||||
|
||||
- name: Create user for ARA
|
||||
become: true
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
CustomLog {{ apache_log_path }}/ara-access.log combined
|
||||
|
||||
SetEnv ANSIBLE_CONFIG /etc/ara/ara.cfg
|
||||
{% if ara.params.virtualenv -%}
|
||||
{% if ara.params.install.pip.virtualenv -%}
|
||||
SetEnv ARA_WSGI_USE_VIRTUALENV 1
|
||||
SetEnv ARA_WSGI_VIRTUALENV_PATH {{ ara.params.virtualenv_path }}
|
||||
SetEnv ARA_WSGI_VIRTUALENV_PATH {{ ara.params.install.pip.virtualenv_path }}
|
||||
|
||||
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4 python-home={{ ara.params.virtualenv_path }}
|
||||
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4 python-home={{ ara.params.install.pip.virtualenv_path }}
|
||||
{% else -%}
|
||||
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4
|
||||
{% endif -%}
|
||||
|
|
Loading…
Reference in New Issue