From 7292c14a3ed6ca0fa6a34d131565256a8dd2f415 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Tue, 19 Jun 2018 10:55:20 -0400 Subject: [PATCH] Don't nest installation variables under a params key We're needlessly nesting "install" under "params". Let's not do that. Change-Id: Ia8ed491bd92d8989a8423a9fbe3a8deb705e7dd7 --- defaults/main.yml | 35 +++++++++++++++---------------- tasks/install/pip.yml | 16 +++++++------- tasks/main.yml | 2 +- templates/apache_mod_wsgi.conf.j2 | 6 +++--- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 83263e6..e3c46e0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,24 +17,23 @@ # along with ARA. If not, see . 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 diff --git a/tasks/install/pip.yml b/tasks/install/pip.yml index 9ecd07a..7cb4c38 100644 --- a/tasks/install/pip.yml +++ b/tasks/install/pip.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index fb4faa5..293c3fb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/templates/apache_mod_wsgi.conf.j2 b/templates/apache_mod_wsgi.conf.j2 index ac561b7..6478757 100644 --- a/templates/apache_mod_wsgi.conf.j2 +++ b/templates/apache_mod_wsgi.conf.j2 @@ -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 -%}