Merge "Avoid writing out requirements.txt in kolla-ansible role"

This commit is contained in:
Zuul 2020-04-22 00:50:45 +00:00 committed by Gerrit Code Review
commit 647b19ae76
3 changed files with 21 additions and 24 deletions

View File

@ -23,6 +23,9 @@ kolla_ansible_venv_python: "python{{ kolla_ansible_venv_python_major_version }}"
# FIXME(mgoddard): Use ansible_python when Kayobe supports Python 3.
kolla_ansible_venv_python_major_version: 3
# Extra requirements to install inside the kolla-ansible virtualenv.
kolla_ansible_venv_extra_requirements: []
# Virtualenv directory where Kolla-ansible's ansible modules will execute
# remotely on the target nodes. If None, no virtualenv will be used.
kolla_ansible_target_venv:

View File

@ -69,14 +69,26 @@
with_items:
- { name: pip }
- name: Ensure python requirements file exists
template:
src: requirements.txt.j2
dest: "{{ kolla_ansible_venv }}/requirements.txt"
- name: Ensure required Python packages are installed
vars:
kolla_ansible_packages:
# Install Kolla Ansible from source or PyPI.
- >-
{% if kolla_ansible_ctl_install_type == 'source' %}
{{ kolla_ansible_source_path }}
{% else %}
kolla-ansible=={{ kolla_openstack_release }}
{% endif %}
# Limit the version of ansible used by kolla-ansible to avoid new
# releases from breaking tested code. Changes to this limit should be
# tested.
- ansible>=2.8,<2.10,!=2.8.9
- >-
{%- if ansible_os_family == 'RedHat' and ansible_distribution_major_version | int >= 8 %}
selinux
{% endif -%}
pip:
requirements: "{{ kolla_ansible_venv }}/requirements.txt"
name: "{{ (kolla_ansible_packages + kolla_ansible_venv_extra_requirements) | select | list }}"
state: latest
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
virtualenv: "{{ kolla_ansible_venv }}"

View File

@ -1,18 +0,0 @@
{% if kolla_ansible_ctl_install_type == 'source' %}
# Install Kolla Ansible from source.
{{ kolla_ansible_source_path }}
{% else %}
# Install Kolla Ansible from PyPI.
kolla-ansible=={{ kolla_openstack_release }}
{% endif %}
# Limit the version of ansible used by kolla-ansible to avoid new releases from
# breaking tested code. Changes to this limit should be tested.
ansible>=2.8,<2.10,!=2.8.9
{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version | int >= 8 %}
selinux
{% endif %}
{% if kolla_ansible_venv_extra_requirements is defined %}
{% for item in kolla_ansible_venv_extra_requirements %}
{{ item }}
{% endfor %}
{% endif %}