99 lines
4.0 KiB
YAML
99 lines
4.0 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.
|
|
|
|
- name: Install distro packages
|
|
package:
|
|
name: "{{ repo_server_distro_packages }}"
|
|
state: "{{ repo_server_package_state }}"
|
|
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
|
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
|
register: install_packages
|
|
until: install_packages | success
|
|
retries: 5
|
|
delay: 5
|
|
|
|
# TODO(odyssey4me):
|
|
# The following two tasks only applies to Pike->Queens upgrades,
|
|
# so they can be removed in Rocky. See:
|
|
# https://bugs.launchpad.net/openstack-ansible/+bug/1746935
|
|
- name: List the current virtualenv_support folders in dist/site-packages
|
|
find:
|
|
file_type: any
|
|
patterns: "virtualenv_support"
|
|
paths:
|
|
- "/usr/local/lib/python2.7/dist-packages"
|
|
- "/usr/local/lib/python2.7/site-packages"
|
|
register: _virtualenv_support
|
|
|
|
# TODO(odyssey4me):
|
|
# We force a reinstall of the required pip packages when the
|
|
# virtualenv_support folder is absent. This is to ensure that
|
|
# we're able to create the venv properly for pypiserver.
|
|
# The state ternary filter can be removed in Rocky as this is
|
|
# only required for Pike->Queens upgrades.
|
|
- name: Install required pip packages
|
|
pip:
|
|
name: "{{ repo_requires_pip_packages }}"
|
|
state: "{{ (_virtualenv_support['matched'] | int > 0) | ternary(repo_server_pip_package_state, 'forcereinstall') }}"
|
|
extra_args: >-
|
|
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
|
{{ pip_install_options | default('') }}
|
|
register: install_packages
|
|
until: install_packages | success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
# Note(odyssey4me):
|
|
# To cater for a situation where the pip packages are changing, but the repo
|
|
# does not yet have the package built, we need to ensure that this task can
|
|
# fetch from pypi. To do this we try the local repo first, then fall back to
|
|
# using pypi.
|
|
- name: Try installing from the repo first, then fall back to using pypi
|
|
block:
|
|
- name: Install pip packages (from repo)
|
|
pip:
|
|
name: "{{ repo_pypiserver_pip_packages }}"
|
|
state: "{{ repo_server_pip_package_state }}"
|
|
virtualenv: "{{ repo_pypiserver_bin | dirname }}"
|
|
virtualenv_site_packages: "no"
|
|
extra_args: >-
|
|
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
|
{{ pip_install_options | default('') }}
|
|
register: install_packages
|
|
until: install_packages | success
|
|
retries: 5
|
|
delay: 2
|
|
notify:
|
|
- reload pypiserver
|
|
rescue:
|
|
- name: Install pip packages (from pypi mirror)
|
|
pip:
|
|
name: "{{ repo_pypiserver_pip_packages }}"
|
|
state: "{{ repo_server_pip_package_state }}"
|
|
virtualenv: "{{ repo_pypiserver_bin | dirname }}"
|
|
virtualenv_site_packages: "no"
|
|
extra_args: >-
|
|
--index-url {{ repo_build_pip_default_index | default('https://pypi.python.org/simple') }}
|
|
--trusted-host {{ (repo_build_pip_default_index | default('https://pypi.python.org/simple')) | netloc_no_port }}
|
|
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
|
{{ pip_install_options | default('') }}
|
|
register: install_packages
|
|
until: install_packages | success
|
|
retries: 5
|
|
delay: 2
|
|
notify:
|
|
- reload pypiserver
|
|
|