Julia Kreger 5cd8658842 Fix upper-constraints use
Upper contrains use has been lacking on some of the
module installs, resulting in occassional issues
being encountered.

Apply the upper constraints file to our pip install
usage.

Change-Id: I877650a094be442218e5f7310037cfb9a523791f
Closes-Bug: #1675808
2018-02-03 14:37:52 +00:00

61 lines
2.3 KiB
YAML

# Copyright (c) 2015 Hewlett Packard Enterprise Development LP.
#
# 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.
---
- name: set virtualenv_command
set_fact:
venv_command: "{{ hostvars[inventory_hostname].ansible_python.executable }} -m virtualenv"
when: enable_venv|bool
- name: "Install {{ package }} package from pip using virtualenv"
pip:
name: "{{ package }}"
state: "{{ state | default(omit) }}"
version: "{{ version | default(omit) }}"
virtualenv: "{{ bifrost_venv_dir }}"
virtualenv_command: "{{ venv_command | default(omit) }}"
extra_args: "{{ extra_args | default(omit) }}"
requirements: "{{ requirements_file | default(omit) }}"
register: pip_package_install_done
until: pip_package_install_done|succeeded
retries: 5
delay: 10
when: (source_install is not defined or source_install == false) and enable_venv|bool
- name: "Install {{ package }} package from pip without virtualenv"
pip:
name: "{{ package }}"
state: "{{ state | default(omit) }}"
version: "{{ version | default(omit) }}"
extra_args: "{{ extra_args | default(omit) }}"
requirements: "{{ requirements_file | default(omit) }}"
register: pip_package_install_done
until: pip_package_install_done|succeeded
retries: 5
delay: 10
when: (source_install is not defined or source_install == false) and not enable_venv|bool
# NOTE (cinerama): We should be able to use the pip module here and
# possibly merge these two tasks when
# https://github.com/ansible/ansible-modules-core/pull/2600 lands.
- name: "Install from {{ sourcedir }} using pip"
command: pip install {{ sourcedir }} {{ extra_args | default('') }}
register: pip_package_install_done
until: pip_package_install_done|succeeded
retries: 5
delay: 10
when: source_install is defined and (source_install | bool == true)
environment: "{{ bifrost_venv_env if enable_venv else {} }}"