Erik Berg db24a0c721
Fix key-order[task] linter warnings
It looks a little jarring at first so see keys ordered this way,
but once you get used to it, it reads so much better!

Also make indentation consistent, clean up epel install
and remove traces of Suse.

Change-Id: Id6279d681faf0c9a1893c00953b0b59d9319e08b
2023-05-30 20:00:34 +02:00

72 lines
2.9 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.
---
- when: not skip_install | bool
block:
- name: "Check that sourcedir is provided with source_install"
fail:
msg: Source installation of requires sourcedir to be provided
when:
- source_install | bool
- not sourcedir
- name: "Set extra_args if upper_constraints_file is defined"
set_fact:
constraints_extra_args: "{{ extra_args | default('') }} -c {{ upper_constraints_file }}"
when:
- upper_constraints_file | length > 0
# NOTE(dtantsur): constraining does not work correctly correctly with
# source installation if the package itself is in constraints.
- not source_install | 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: "python3 -m venv"
extra_args: "{{ constraints_extra_args | default(extra_args) | default(omit) }}"
register: pip_package_install_done
until: pip_package_install_done is succeeded
retries: "{{ pip_install_retries }}"
delay: "{{ pip_install_delay }}"
when: not source_install | bool
environment:
# NOTE(dtantsur): https://github.com/pypa/setuptools/issues/2353
SETUPTOOLS_USE_DISTUTILS: stdlib
- name: "Install requirements from {{ sourcedir }} using pip"
pip:
extra_args: "{{ extra_args }} {% if upper_constraints_file %}-c {{ upper_constraints_file }}{% endif %}"
requirements: "{{ sourcedir }}/requirements.txt"
register: pip_package_install_done
until: pip_package_install_done is succeeded
retries: 5
delay: 10
when: source_install | bool
environment: "{{ bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'}) }}"
# NOTE(dtantsur): do not use constraints here, it does not work when the
# package itself is constrained.
- name: "Install from {{ sourcedir }} using pip"
pip:
name: "{{ sourcedir }}"
editable: "{{ developer_mode | bool }}"
extra_args: "{{ extra_args }}"
when: source_install | bool
environment: "{{ bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'}) }}"