diff --git a/defaults/main.yml b/defaults/main.yml index 2f53b96..1b7805e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,11 +33,12 @@ mistral_package_state: latest mistral_role_project_group: mistral_all # Source package builds -mistral_developer_mode: false mistral_git_repo: https://git.openstack.org/openstack/mistral mistral_git_install_branch: master -mistral_developer_constraints: +mistral_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')) }}" +mistral_git_constraints: - "git+{{ mistral_git_repo }}@{{ mistral_git_install_branch }}#egg=mistral" + - "--constraint {{ mistral_upper_constraints_url }}" mistral_pip_packages: - mistral - PyMySQL @@ -47,16 +48,8 @@ mistral_optional_oslomsg_amqp1_pip_packages: - oslo.messaging[amqp1] mistral_venv_tag: "{{ venv_tag | default('untagged') }}" mistral_bin: "{{ _mistral_bin }}" -# 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. -mistral_pip_install_args: >- - {{ mistral_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }} - {{ pip_install_options | default('') }} + +mistral_pip_install_args: "{{ pip_install_options | default('') }}" # Services mistral_services: @@ -161,3 +154,6 @@ mistral_service_internaluri_proto: "{{ openstack_service_internaluri_proto | def mistral_service_internalurl: "{{ mistral_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ mistral_service_port }}/v2" mistral_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(mistral_service_proto) }}" mistral_service_adminurl: "{{ mistral_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ mistral_service_port }}/v2" + +# Specific pip packages provided by the user +mistral_user_pip_packages: [] diff --git a/tasks/mistral_install.yml b/tasks/mistral_install.yml index 2999a57..c78c77a 100644 --- a/tasks/mistral_install.yml +++ b/tasks/mistral_install.yml @@ -70,8 +70,22 @@ retries: 5 delay: 2 -- name: Install mistral packages from PIP - include_tasks: mistral_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ mistral_git_constraints }}" + venv_build_distro_package_list: "{{ mistral_devel_distro_packages }}" + venv_install_destination_path: "{{ mistral_bin | dirname }}" + venv_pip_install_args: "{{ mistral_pip_install_args }}" + venv_pip_packages: >- + {{ mistral_pip_packages | + union(mistral_user_pip_packages) | + union(((mistral_oslomsg_amqp1_enabled | bool) | ternary(mistral_optional_oslomsg_amqp1_pip_packages, []))) }} + venv_facts_when_changed: + - section: "mistral" + option: "venv_tag" + value: "{{ mistral_venv_tag }}" when: mistral_install_method == 'source' - name: Record the need for a service restart diff --git a/tasks/mistral_install_source.yml b/tasks/mistral_install_source.yml deleted file mode 100644 index 1e77526..0000000 --- a/tasks/mistral_install_source.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -# Copyright 2019, VEXXHOST, 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 mistral_developer_constraints %} - {{ item }} - {% endfor %} - when: mistral_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: mistral_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_build_distro_package_list: "{{ mistral_devel_distro_packages }}" - venv_install_destination_path: "{{ mistral_bin | dirname }}" - venv_pip_install_args: "{{ mistral_pip_install_args }}" - venv_pip_packages: >- - {{ mistral_pip_packages + - (mistral_oslomsg_amqp1_enabled | bool) | ternary(mistral_optional_oslomsg_amqp1_pip_packages, []) }} - venv_facts_when_changed: - - section: "mistral" - option: "need_service_restart" - value: True - - section: "mistral" - option: "venv_tag" - value: "{{ mistral_venv_tag }}"