77bebc92f8
This is similar to commit c180998193
("playbooks: roles:
bifrost-ironic-install: Retry failed PXE downloads"). Fetching
dependencies from the PYPI website may fail for various reasons
so retry installing the packages a few times before giving up.
This aims to workaround problems like the following one:
TASK [bifrost-ironic-install : Install ironic-inspector package from
pip] ******
[...]
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "/bin/pip
install -U ironic-inspector", "failed": true, "invocation":
{"module_args": {"chdir": null, "editable": true, "executable": null,
"extra_args": null, "name": "ironic-inspector", "requirements": null,
"state": "latest", "umask": null, "use_mirrors": true, "version": null,
"virtualenv": "", "virtualenv_command": "virtualenv",
"virtualenv_python": null, "virtualenv_site_packages": false},
"module_name": "pip"}, "msg": "\n:stderr: Exception:
[...]
raise RetryError(e, request=request)\nRetryError:
HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries
exceeded with url: /simple/ironic-inspector/ (Caused by
ResponseError('too many 503 error responses',))
Change-Id: I2a1958d661c41e3c635598c165f285b617053aad
46 lines
1.8 KiB
YAML
46 lines
1.8 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
|
|
|
|
- name: "Install {{ package }} package from pip"
|
|
pip:
|
|
name: "{{ package }}"
|
|
state: "{{ state | default(omit) }}"
|
|
version: "{{ version | default(omit) }}"
|
|
virtualenv: "{{ bifrost_venv_dir if enable_venv else omit }}"
|
|
virtualenv_command: "{{ venv_command | default(omit) }}"
|
|
extra_args: "{{ extra_args | 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
|
|
# 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 '{}' }}"
|