Avoid writing out requirements.txt in kolla-ansible role
We can use the Ansible pip module's support for specifying a list of packages with version constraints. Change-Id: If5d3c7117175732c54e38025692eb4c036053ebc
This commit is contained in:
parent
e0932bd788
commit
58db0ed2e0
@ -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.
|
# FIXME(mgoddard): Use ansible_python when Kayobe supports Python 3.
|
||||||
kolla_ansible_venv_python_major_version: 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
|
# Virtualenv directory where Kolla-ansible's ansible modules will execute
|
||||||
# remotely on the target nodes. If None, no virtualenv will be used.
|
# remotely on the target nodes. If None, no virtualenv will be used.
|
||||||
kolla_ansible_target_venv:
|
kolla_ansible_target_venv:
|
||||||
|
@ -69,14 +69,26 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- { name: pip }
|
- { 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
|
- 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:
|
pip:
|
||||||
requirements: "{{ kolla_ansible_venv }}/requirements.txt"
|
name: "{{ (kolla_ansible_packages + kolla_ansible_venv_extra_requirements) | select | list }}"
|
||||||
state: latest
|
state: latest
|
||||||
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
|
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
|
||||||
virtualenv: "{{ kolla_ansible_venv }}"
|
virtualenv: "{{ kolla_ansible_venv }}"
|
||||||
|
@ -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 %}
|
|
Loading…
x
Reference in New Issue
Block a user