diff --git a/defaults/main.yml b/defaults/main.yml index de44dc08..e1bf4358 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -32,20 +32,12 @@ glance_pip_package_state: "latest" glance_git_repo: https://git.openstack.org/openstack/glance glance_git_install_branch: master -glance_developer_mode: false -glance_developer_constraints: +glance_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')) }}" +glance_git_constraints: - "git+{{ glance_git_repo }}@{{ glance_git_install_branch }}#egg=glance" + - "--constraint {{ glance_upper_constraints_url }}" -# 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. -glance_pip_install_args: >- - {{ glance_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('') }} +glance_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into glance_venv_tag: "{{ venv_tag | default('untagged') }}" @@ -57,11 +49,6 @@ glance_bin: "{{ _glance_bin }}" # glance_etc_dir: "/usr/local/etc/glance" glance_etc_dir: "/etc/glance" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -glance_venv_download: "{{ not glance_developer_mode | bool }}" -glance_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/glance.tgz - # Enable/Disable Ceilometer glance_ceilometer_enabled: False diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 849a6e23..bdef135c 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -127,8 +127,27 @@ retries: 5 delay: 2 -- name: Install glance packages from PIP - include_tasks: glance_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + private: yes + vars: + venv_build_constraints: "{{ glance_git_constraints }}" + venv_build_distro_package_list: "{{ glance_devel_distro_packages }}" + venv_install_destination_path: "{{ glance_bin | dirname }}" + venv_install_distro_package_list: "{{ glance_distro_packages }}" + venv_pip_install_args: "{{ glance_pip_install_args }}" + venv_pip_packages: >- + {{ glance_pip_packages | + union(glance_user_pip_packages) | + union(((glance_oslomsg_amqp1_enabled | bool) | ternary(glance_optional_oslomsg_amqp1_pip_packages, []))) }} + venv_facts_when_changed: + - section: "glance" + option: "need_service_restart" + value: True + - section: "glance" + option: "venv_tag" + value: "{{ glance_venv_tag }}" when: glance_install_method == 'source' - name: Record the need for a service restart diff --git a/tasks/glance_install_source.yml b/tasks/glance_install_source.yml deleted file mode 100644 index dace7d97..00000000 --- a/tasks/glance_install_source.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -# Copyright 2014, 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 glance_developer_constraints %} - {{ item }} - {% endfor %} - when: glance_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - glance_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_build_distro_package_list: "{{ glance_devel_distro_packages }}" - venv_install_destination_path: "{{ glance_bin | dirname }}" - venv_install_distro_package_list: "{{ glance_distro_packages }}" - venv_pip_install_args: "{{ glance_pip_install_args }}" - venv_pip_packages: "{{ glance_pip_packages | union(glance_user_pip_packages) + - (glance_oslomsg_amqp1_enabled | bool) | ternary(glance_optional_oslomsg_amqp1_pip_packages, []) }}" - venv_facts_when_changed: - - section: "glance" - option: "need_service_restart" - value: True - - section: "glance" - option: "venv_tag" - value: "{{ glance_venv_tag }}" - -- name: Link in the os-brick rootwrap filters - file: - src: "{{ glance_bin | dirname }}/etc/os-brick/rootwrap.d/os-brick.filters" - dest: "{{ glance_etc_dir }}/rootwrap.d/os-brick.filters" - state: link diff --git a/tasks/main.yml b/tasks/main.yml index 32a66d3c..13356e8a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -40,11 +40,11 @@ tags: - always -- include_tasks: glance_install.yml +- import_tasks: glance_install.yml tags: - glance-install -- include_tasks: glance_post_install.yml +- import_tasks: glance_post_install.yml tags: - glance-config