openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml
Jean-Philippe Evrard 03a57d6668 Set the default pip index dynamically
Before the repo server is up, only bare metal hosts
need pip installed, openstack-hosts-setup take care
of that part by default, with the openstack_host role
calling pip_install.

Once the repo server is up, the pypi cache will be available
to be used. This implements the changes to detect whether it
is available - this is important for the plays doing pip
installs before the repo server is available. Once it is
available the same plays will use it.

To be available, we need to wait for haproxy playbook to
load balance towards the repo container, or the baremetal
node if need be.

Once the repo server and the load balancer are up, we
can configure everything to use the repo server, and this
will be done with the repo-use.yml playbook, which is
calling the pip_install role.

We also remove the use of the pip_lock_to_internal_repo
from group variables, as we want to change the pip.conf
dynamically depending on the availability of the default
index.

Finally, we set the AIO in OpenStack-Infra to make use of
the appropriate infra mirror for the nginx reverse proxy.

Because the gates are blocked without this patch, this
patch should land in priority. The current upstream state
prevents that, so we temporarily disable the ceph testing,
which fails due to [1]. On top of it, we need to bump
shas to a known working state, else tempest would fail.
To avoid circular dependencies, we include the content
of patch [2], which is the sha bump pending this work.

[1]: https://bugs.launchpad.net/cinder/+bug/1737015
[2]: https://review.openstack.org/#/c/522850/

Change-Id: If19442918baa9ddacf7c19940c9b5007694bee61
Depends-On: I56f22f46ff849a7049ac7ae873af7a4bc526fa63
Depends-On: Ic4fd64f4dc82121a65088f3d7f4ae53f373df608
Depends-On: I7bd31f2d89d3fe9d48e32c79ddef7a8ef1392eb7
Depends-On: Icd93c0c801bfee1b4fdc8154d078067722c0640a
Depends-On: I1e9782eb0fd72690a9644c7a01e8c83a4486872b
Co-Authored-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2017-12-08 15:46:06 +00:00

79 lines
2.7 KiB
YAML

---
# Copyright 2016, 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.
# This set of tasks checks whether the repo is up yet. If it is it
# will use the compiled upper constraints available there. If it
# is not yet up, then it will use the upstream upper constraints
# for the SHA currently pinned.
- name: Test internal repo URL for the current upper constraints file
uri:
url: "{{ pip_install_upper_constraints }}"
method: "HEAD"
register: upper_constraints_check
failed_when: false
tags:
- common-constraints
- name: Test internal repo URL for the availability of the pypi index
uri:
url: "{{ pip_default_index }}"
method: "HEAD"
register: pip_default_index_check
failed_when: false
tags:
- common-constraints
- name: Remove global requirement pins file from host
file:
path: "/opt/global-requirement-pins.txt"
state: absent
when: (upper_constraints_check.status | default(503)) == 200
tags:
- common-constraints
- name: Copy global requirement pins file to host
copy:
src: "../global-requirement-pins.txt"
dest: "/opt/global-requirement-pins.txt"
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints
# Use https when Python with native SNI support is available
- name: Set pip install upper constraints protocol
set_fact:
pip_install_upper_constraints_proto: "{{ ansible_python_version | version_compare('2.7.9', '>=') | ternary('https','http') }}"
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints
- name: Set pip install upper constraints
set_fact:
pip_install_upper_constraints: >-
/opt/global-requirement-pins.txt
--constraint {{ pip_install_upper_constraints_proto }}://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id={{ requirements_git_install_branch | regex_replace(' #.*$','') }}
when: (upper_constraints_check.status | default(503)) != 200
tags:
- common-constraints
- name: Fallback to PyPI
set_fact:
pip_default_index: "https://pypi.python.org/simple"
pip_lock_to_internal_repo: False
when: (pip_default_index_check.status | default(503)) != 200
tags:
- common-constraints