openstack-ansible-os_ironic/tasks/ironic_install.yml
Jesse Pretorius 75e85cff4c Consolidate pip install tasks
The pip install tasks were distributed into many files with no clear
benefit from doing so. This patch consolidates the pip install tasks
to ensure that they are all handled together, are all installed into
the appropriate venv, and all use the right constraints.

Change-Id: I8bad68c57c0ffa986817aa80d79e9d2ab4b86a3d
2016-03-22 14:43:39 +00:00

109 lines
2.9 KiB
YAML

---
# Copyright 2014, 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: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"
content: |
{% for item in ironic_developer_constraints %}
{{ item }}
{% endfor %}
when:
- ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages
- name: Clone requirements git repository
git:
repo: "{{ ironic_requirements_git_repo }}"
dest: "/opt/requirements"
clone: yes
update: yes
version: "{{ ironic_requirements_git_install_branch }}"
when:
- ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages
- name: Add constraints to pip_install_options fact for developer mode
set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt"
when:
- ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages
- name: Set pip_install_options_fact when not in developer mode
set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }}"
when:
- not ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages
- name: Install requires pip packages
pip:
name: "{{ item }}"
state: present
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: ironic_requires_pip_packages
tags:
- ironic-install
- ironic-pip-packages
- name: Install pip packages (venv)
pip:
name: "{{ item }}"
state: present
virtualenv: "{{ ironic_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: ironic_pip_packages
when:
- ironic_venv_enabled | bool
- ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
state: present
extra_args: "{{ pip_install_options_fact }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: ironic_pip_packages
when:
- not ironic_venv_enabled | bool
- not ironic_developer_mode | bool
tags:
- ironic-install
- ironic-pip-packages