Install openstack.kolla collection

This patch adds the openstack.kolla collection to the Galaxy
requirements. It is installed from the OpenDev git repository. The
collection is not yet used by Kayobe.

Zuul cross-project dependencies on the ansible-collection-kolla
repository are supported (and used in this commit).

Story: 2009854
Task: 44503

Depends-On: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/820165/
Change-Id: I91cbac839f816a00ac54bc4a350f44b5ae457cc3
This commit is contained in:
Mark Goddard 2022-01-17 16:31:36 +00:00 committed by Pierre Riteau
parent cb48f7e5d2
commit 06c6191799
6 changed files with 53 additions and 0 deletions

View File

@ -36,6 +36,12 @@
content: "{{ ansible_cfg }}" content: "{{ ansible_cfg }}"
dest: "{{ kayobe_config_src_dir }}/etc/kayobe/ansible.cfg" dest: "{{ kayobe_config_src_dir }}/etc/kayobe/ansible.cfg"
- name: Update kayobe requirements.yml
include_role:
name: kayobe-galaxy-requirements
vars:
kayobe_galaxy_requirements_src_dir: "{{ kayobe_src_dir }}"
- block: - block:
- name: Ensure previous kayobe directory exists - name: Ensure previous kayobe directory exists
file: file:
@ -60,4 +66,14 @@
path: "{{ previous_kayobe_src_dir }}/dev/config.sh" path: "{{ previous_kayobe_src_dir }}/dev/config.sh"
line: "export KAYOBE_EXTRA_ARGS=-vvv" line: "export KAYOBE_EXTRA_ARGS=-vvv"
regexp: "^#export KAYOBE_EXTRA_ARGS=$" regexp: "^#export KAYOBE_EXTRA_ARGS=$"
- name: Update kayobe requirements.yml
include_role:
name: kayobe-galaxy-requirements
vars:
kayobe_galaxy_requirements_src_dir: "{{ previous_kayobe_src_dir }}"
kayobe_galaxy_requirements_branch: "stable/{{ previous_release | lower }}"
# TODO(mgoddard): Always do this when previous release is Yoga.
when: previous_release != 'xena'
when: is_upgrade when: is_upgrade

View File

@ -1,4 +1,8 @@
--- ---
collections:
- name: https://opendev.org/openstack/ansible-collection-kolla
type: git
version: master
roles: roles:
- src: ahuffman.resolv - src: ahuffman.resolv
version: 1.3.1 version: 1.3.1

View File

@ -0,0 +1,6 @@
==========================
Kayobe Galaxy Requirements
==========================
Ansible role to modify an Ansible Galaxy requirements file to include Ansible
content in Zuul required projects.

View File

@ -0,0 +1,5 @@
---
kayobe_galaxy_requirements_src_dir:
kayobe_galaxy_requirements_branch: "{{ zuul.branch }}"
kayobe_galaxy_requirements_src_path: "requirements.yml"
kayobe_galaxy_requirements_dest_path: "{{ kayobe_galaxy_requirements_src_dir }}/{{ kayobe_galaxy_requirements_src_path }}"

View File

@ -0,0 +1,20 @@
---
- name: Slurp requirements.yml
command:
cmd: "git show {{ kayobe_galaxy_requirements_branch }}:{{ kayobe_galaxy_requirements_src_path }}"
chdir: "{{ kayobe_galaxy_requirements_src_dir }}"
register: requirements_yml
- name: Write requirements.yml
copy:
content: "{{ new_requirements | to_nice_yaml }}"
dest: "{{ kayobe_galaxy_requirements_dest_path }}"
vars:
old_requirements: "{{ requirements_yml.stdout | from_yaml }}"
new_requirement:
name: "file://{{ ansible_collection_kolla_src_dir }}"
type: git
version: "{{ kayobe_galaxy_requirements_branch }}"
new_requirements:
collections: "{{ (old_requirements.collections | rejectattr('name', 'search', 'ansible-collection-kolla') | list) + [new_requirement] }}"
roles: "{{ old_requirements.roles | default([]) }}"

View File

@ -56,6 +56,7 @@
attempts: 5 attempts: 5
required-projects: required-projects:
# Include kayobe to ensure other projects can use this job. # Include kayobe to ensure other projects can use this job.
- name: openstack/ansible-collection-kolla
- name: openstack/kayobe - name: openstack/kayobe
- name: openstack/kayobe-config-dev - name: openstack/kayobe-config-dev
- name: openstack/kolla - name: openstack/kolla
@ -75,6 +76,7 @@
# Name of the release to upgrade from for upgrade jobs. # Name of the release to upgrade from for upgrade jobs.
previous_release: xena previous_release: xena
logs_dir: "/tmp/logs" logs_dir: "/tmp/logs"
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_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 }}" kayobe_config_src_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['opendev.org/openstack/kayobe-config-dev'].src_dir }}"
previous_kayobe_src_dir: "{{ ansible_env.PWD ~ '/previous/kayobe' }}" previous_kayobe_src_dir: "{{ ansible_env.PWD ~ '/previous/kayobe' }}"