Install Ansible collections for kolla-ansible

This change uses the new Galaxy requirements file in Kolla Ansible to
install the openstack.kolla collection.

Cross-project dependencies on ansible-collection-kolla are supported.

Story: 2009854
Task: 44504

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/819430
Change-Id: Iac185dd2bbbca128c6cf71b2734e94b3e1c6133b
This commit is contained in:
Mark Goddard 2022-01-17 16:44:43 +00:00 committed by Pierre Riteau
parent 06c6191799
commit 3efc551e7e
9 changed files with 37 additions and 0 deletions

View File

@ -21,6 +21,9 @@ kolla_ansible_venv_python: python3
# Extra requirements to install inside the kolla-ansible virtualenv.
kolla_ansible_venv_extra_requirements: []
# Path to a requirements.yml file for Ansible collections.
kolla_ansible_requirements_yml: "{{ kolla_ansible_venv }}/share/kolla-ansible/requirements.yml"
# 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

@ -106,3 +106,10 @@
extra_args: "{% if kolla_upper_constraints_file %}-c {{ kolla_upper_constraints_file }}{% endif %}"
virtualenv: "{{ kolla_ansible_venv }}"
virtualenv_python: "{{ kolla_ansible_venv_python }}"
- name: Ensure Ansible collections are installed
command:
cmd: >-
ansible-galaxy collection install
-r {{ kolla_ansible_requirements_yml }}
-p {{ kolla_ansible_venv }}/share/kolla-ansible/ansible/collections/

View File

@ -42,6 +42,13 @@
vars:
kayobe_galaxy_requirements_src_dir: "{{ kayobe_src_dir }}"
- name: Update kolla-ansible requirements.yml
include_role:
name: kayobe-galaxy-requirements
vars:
kayobe_galaxy_requirements_src_dir: "{{ kolla_ansible_src_dir }}"
kayobe_galaxy_requirements_dest_path: "/tmp/kolla-ansible-requirements.yml"
- block:
- name: Ensure previous kayobe directory exists
file:
@ -76,4 +83,14 @@
# TODO(mgoddard): Always do this when previous release is Yoga.
when: previous_release != 'xena'
- name: Update kolla-ansible requirements.yml
include_role:
name: kayobe-galaxy-requirements
vars:
kayobe_galaxy_requirements_src_dir: "{{ previous_kolla_ansible_src_dir }}"
kayobe_galaxy_requirements_branch: "stable/{{ previous_release | lower }}"
kayobe_galaxy_requirements_dest_path: "/tmp/previous-kolla-ansible-requirements.yml"
# TODO(mgoddard): Always do this when previous release is Yoga.
when: previous_release != 'xena'
when: is_upgrade

View File

@ -14,6 +14,7 @@ kolla_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/opensta
kolla_source_version: "{{ zuul.projects['opendev.org/openstack/kolla'].checkout }}"
kolla_ansible_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
kolla_ansible_source_version: "{{ zuul.projects['opendev.org/openstack/kolla-ansible'].checkout }}"
kolla_ansible_requirements_yml: "/tmp/kolla-ansible-requirements.yml"
kolla_openstack_logging_debug: True
pip_upper_constraints_file: "/tmp/upper-constraints.txt"

View File

@ -15,7 +15,10 @@ kolla_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/opensta
kolla_source_version: "{{ zuul.projects['opendev.org/openstack/kolla'].checkout }}"
kolla_ansible_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
kolla_ansible_source_version: "{{ zuul.projects['opendev.org/openstack/kolla-ansible'].checkout }}"
kolla_ansible_requirements_yml: "/tmp/kolla-ansible-requirements.yml"
pip_upper_constraints_file: "/tmp/upper-constraints.txt"
{% else %}
kolla_ansible_requirements_yml: "/tmp/previous-kolla-ansible-requirements.yml"
{% endif %}
kolla_openstack_logging_debug: true

View File

@ -16,6 +16,7 @@ kolla_source_url: "/tmp/kolla"
kolla_source_version: "{{ zuul.projects['opendev.org/openstack/kolla'].checkout }}"
kolla_ansible_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
kolla_ansible_source_version: "{{ zuul.projects['opendev.org/openstack/kolla-ansible'].checkout }}"
kolla_ansible_requirements_yml: "/tmp/kolla-ansible-requirements.yml"
kolla_openstack_logging_debug: True
pip_upper_constraints_file: "/tmp/upper-constraints.txt"

View File

@ -15,7 +15,10 @@ kolla_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/opensta
kolla_source_version: "{{ zuul.projects['opendev.org/openstack/kolla'].checkout }}"
kolla_ansible_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
kolla_ansible_source_version: "{{ zuul.projects['opendev.org/openstack/kolla-ansible'].checkout }}"
kolla_ansible_requirements_yml: "/tmp/kolla-ansible-requirements.yml"
pip_upper_constraints_file: "/tmp/upper-constraints.txt"
{% else %}
kolla_ansible_requirements_yml: "/tmp/previous-kolla-ansible-requirements.yml"
{% endif %}
kolla_openstack_logging_debug: True

View File

@ -11,6 +11,7 @@ kolla_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/opensta
kolla_source_version: "{{ zuul.projects['opendev.org/openstack/kolla'].checkout }}"
kolla_ansible_source_url: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
kolla_ansible_source_version: "{{ zuul.projects['opendev.org/openstack/kolla-ansible'].checkout }}"
kolla_ansible_requirements_yml: "/tmp/kolla-ansible-requirements.yml"
kolla_openstack_logging_debug: True
pip_upper_constraints_file: "/tmp/upper-constraints.txt"

View File

@ -79,6 +79,7 @@
ansible_collection_kolla_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/ansible-collection-kolla'].src_dir }}"
kayobe_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kayobe'].src_dir }}"
kayobe_config_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kayobe-config-dev'].src_dir }}"
kolla_ansible_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kolla-ansible'].src_dir }}"
previous_kayobe_src_dir: "{{ ansible_env.PWD ~ '/previous/kayobe' }}"
previous_kayobe_config_src_dir: "{{ ansible_env.PWD ~ '/previous/kayobe-config' }}"
requirements_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/requirements'].src_dir }}"