openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml
Kevin Carter d7c57113b1
Added a common tag to the common tasks
This change adds a tag to all of the common tasks which may be useful
in situations where only these common tasks may need to be rerun.

Example scenario:
  RabbitMQ has failed and was re-built, in order to recreate the
  rabbitmq vhosts the user can now use the "common-rabbitmq" tag
  to recovery the cluster.

Change-Id: I973d2f5269e911256825249f86dc2985790e6880
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-03-02 10:19:19 -06:00

62 lines
2.2 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: 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