diff --git a/defaults/main.yml b/defaults/main.yml index e55e6e7..945b6b9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -42,9 +42,12 @@ gnocchi_auth_mode: "{{ (gnocchi_keystone_auth | bool) | ternary('keystone', 'bas # of an OpenStack-Ansible repo_server. gnocchi_git_repo: https://github.com/gnocchixyz/gnocchi gnocchi_git_install_branch: master -gnocchi_developer_mode: false -gnocchi_developer_constraints: +gnocchi_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}" +gnocchi_git_constraints: - "git+{{ gnocchi_git_repo }}@{{ gnocchi_git_install_branch }}#egg=gnocchi" + - "--constraint {{ gnocchi_upper_constraints_url }}" + +gnocchi_pip_install_args: "{{ pip_install_options | default('') }}" #: Use of deprecated config options will cause a fatal application error gnocchi_fatal_deprecations: false @@ -56,16 +59,6 @@ gnocchi_secure_proxy_ssl_header: HTTP_X_FORWARDED_PROTO #: Set this to false to disable API service through Apache + mod_wsgi gnocchi_use_mod_wsgi: true -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -gnocchi_pip_install_args: >- - {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ pip_install_options | default('') }} - #: Name of the virtual env to deploy into gnocchi_venv_tag: "{{ venv_tag | default('untagged') }}" gnocchi_bin: "/openstack/venvs/gnocchi-{{ gnocchi_venv_tag }}/bin" @@ -77,12 +70,6 @@ gnocchi_venv_pkgs: "/openstack/venvs/gnocchi-{{ gnocchi_venv_tag }}/lib/python2. # gnocchi_etc_dir: "/usr/local/etc/gnocchi" gnocchi_etc_dir: "{{ gnocchi_bin | dirname }}/etc/gnocchi" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -gnocchi_venv_download: "{{ not gnocchi_developer_mode | bool and not gnocchi_identity_only | bool }}" -#: Location to retrieve the pre-built virtuelenv for gnocchi (optional) -gnocchi_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/gnocchi.tgz - #: Index Database info gnocchi_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}" gnocchi_galera_address: "{{ galera_address | default('127.0.0.1') }}" diff --git a/tasks/gnocchi_install.yml b/tasks/gnocchi_install.yml deleted file mode 100644 index fc50356..0000000 --- a/tasks/gnocchi_install.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -# Copyright 2015, Rackspace US, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -- name: Create developer mode constraint file - copy: - dest: "/opt/developer-pip-constraints.txt" - content: | - {% for item in gnocchi_developer_constraints %} - {{ item }} - {% endfor %} - when: gnocchi_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ ansible_hostname }}" - when: - - gnocchi_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_install_destination_path: "{{ gnocchi_bin | dirname }}" - venv_install_distro_package_list: "{{ gnocchi_distro_packages }}" - venv_pip_install_args: "{{ gnocchi_pip_install_args }}" - venv_pip_packages: "{{ gnocchi_pip_packages }}" - venv_facts_when_changed: - - section: "gnocchi" - option: "venv_tag" - value: "{{ gnocchi_venv_tag }}" diff --git a/tasks/main.yml b/tasks/main.yml index 5e0aa8f..77ac519 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -25,21 +25,33 @@ tags: - always -- include_tasks: gnocchi_pre_install.yml +- import_tasks: gnocchi_pre_install.yml tags: - gnocchi-install -- include_tasks: gnocchi_install.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ gnocchi_git_constraints }}" + venv_install_destination_path: "{{ gnocchi_bin | dirname }}" + venv_install_distro_package_list: "{{ gnocchi_distro_packages }}" + venv_pip_install_args: "{{ gnocchi_pip_install_args }}" + venv_pip_packages: "{{ gnocchi_pip_packages }}" + venv_facts_when_changed: + - section: "gnocchi" + option: "venv_tag" + value: "{{ gnocchi_venv_tag }}" tags: - gnocchi-install -- include_tasks: gnocchi_post_install.yml +- import_tasks: gnocchi_post_install.yml when: not gnocchi_identity_only | bool tags: - gnocchi-config - name: Run the systemd service role - include_role: + import_role: name: systemd_service vars: systemd_user_name: "{{ gnocchi_system_user_name }}" @@ -57,19 +69,19 @@ - gnocchi-config - systemd-service -- include_tasks: gnocchi_service_setup.yml +- import_tasks: gnocchi_service_setup.yml when: - inventory_hostname == groups['gnocchi_all'][0] - not gnocchi_identity_only | bool tags: - gnocchi-config -- include_tasks: gnocchi_identity_setup.yml +- import_tasks: gnocchi_identity_setup.yml when: inventory_hostname == groups['gnocchi_all'][0] tags: - gnocchi-config -- include_tasks: gnocchi_ceph_python_libs.yml +- import_tasks: gnocchi_ceph_python_libs.yml when: - gnocchi_storage_driver == 'ceph' tags: @@ -77,14 +89,14 @@ # N.B. Must occur after identity setup, as this may perform calls to Swift. # Similarly, when using Ceph, must occur after Ceph setup. -- include_tasks: gnocchi_db_setup.yml +- import_tasks: gnocchi_db_setup.yml when: - inventory_hostname == groups['gnocchi_all'][0] - not gnocchi_identity_only | bool tags: - gnocchi-config -- include_tasks: gnocchi_apache.yml +- import_tasks: gnocchi_apache.yml when: - gnocchi_use_mod_wsgi | bool - not gnocchi_identity_only | bool