Don't nest installation variables under a params key

We're needlessly nesting "install" under "params".
Let's not do that.

Change-Id: Ia8ed491bd92d8989a8423a9fbe3a8deb705e7dd7
This commit is contained in:
David Moreau Simard 2018-06-19 10:55:20 -04:00
parent 90df161d75
commit 7292c14a3e
No known key found for this signature in database
GPG Key ID: 33A07694CBB71ECC
4 changed files with 29 additions and 30 deletions

View File

@ -17,24 +17,23 @@
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
ara:
params:
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:
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

View File

@ -36,26 +36,26 @@
pip:
name: setuptools
state: latest
virtualenv: "{{ ara.params.install.pip.virtualenv_path }}"
when: ara.params.install.pip.virtualenv | bool
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.params.install.pip.method == 'source' and ara.params.install.pip.version -%}
{{- ara.params.install.pip.source }}@{{ ara.params.install.pip.version | default('master') -}}
{%- 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.params.install.pip.version | default(omit, True) }}"
version: "{{ ara.install.pip.version | default(omit, True) }}"
state: present
virtualenv: "{{ ara.params.install.pip.virtualenv | bool | ternary(ara.params.install.pip.virtualenv_path, omit) }}"
virtualenv: "{{ ara.install.pip.virtualenv | bool | ternary(ara.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
path_with_virtualenv: "{{ ara.install.pip.virtualenv_path }}/bin:{{ ansible_env.PATH }}"
when: ara.install.pip.virtualenv | bool

View File

@ -30,7 +30,7 @@
- ara_override is mapping
- name: Include ARA installation
include_tasks: "install/{{ ara.params.install.method }}.yml"
include_tasks: "install/{{ ara.install.method }}.yml"
- name: Create user for ARA
become: true

View File

@ -6,11 +6,11 @@
CustomLog {{ apache_log_path }}/ara-access.log combined
SetEnv ANSIBLE_CONFIG /etc/ara/ara.cfg
{% if ara.params.install.pip.virtualenv -%}
{% if ara.install.pip.virtualenv -%}
SetEnv ARA_WSGI_USE_VIRTUALENV 1
SetEnv ARA_WSGI_VIRTUALENV_PATH {{ ara.params.install.pip.virtualenv_path }}
SetEnv ARA_WSGI_VIRTUALENV_PATH {{ ara.install.pip.virtualenv_path }}
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4 python-home={{ ara.params.install.pip.virtualenv_path }}
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4 python-home={{ ara.install.pip.virtualenv_path }}
{% else -%}
WSGIDaemonProcess ara user=ara group=ara processes=1 threads=4
{% endif -%}