kayobe/ansible/container-image-build.yml
Mark Goddard 3c1b9c4d9a Remove kolla_install_type variable
Kolla removed support for binary images in the Zed release, as well as
the install_type config option. It also changed the image tag format.

Yoga & earlier:

  openstack.kolla/centos-source-base:yoga

Zed & later:

  openstack.kolla/base:zed-centos-stream9

This change removes the kolla_install_type variable. It also adds a
kolla_base_distro_version variable, which is passed to kolla and
kolla-ansible.

The following two variables are also removed, since all images are now
of type source:

* overcloud_container_image_regex_map_source
* overcloud_container_image_regexes_source

Change-Id: I0023765438c0c73394c3465828c4d98f766d9350
2022-12-02 10:36:45 +00:00

61 lines
2.2 KiB
YAML

---
- name: Ensure Kolla container images are built
hosts: container-image-builders
vars:
# Set this to True to push images to the registry when built.
push_images: False
# Set this to True to skip using cache.
nocache: False
# Set this variable to a space-separated list of regexes to override the
# default set of images.
container_image_regexes: ""
kolla_build_log_path: "/var/log/kolla-build.log"
tasks:
- name: Set the container image sets to build if images regexes specified
set_fact:
container_image_sets:
- regexes: "{{ container_image_regexes }}"
when: container_image_regexes != ''
- name: Display the regexes for container images that will be built
debug:
msg: >
Building container images matching
'{{ item.regexes }}'. Build logs will be appended to
{{ kolla_build_log_path }}.
with_items: "{{ container_image_sets }}"
- name: Ensure Kolla build log file exists
file:
path: "{{ kolla_build_log_path }}"
state: touch
owner: "{{ ansible_facts.user_uid }}"
group: "{{ ansible_facts.user_gid }}"
become: True
- name: Login to docker registry
docker_login:
registry_url: "{{ kolla_docker_registry or omit }}"
username: "{{ kolla_docker_registry_username }}"
password: "{{ kolla_docker_registry_password }}"
reauthorize: yes
when:
# NOTE(wszumski): Switch to truthy filter when min ansible>=2.10.5
- kolla_docker_registry_username not in [none, ""]
- kolla_docker_registry_password not in [none, ""]
- name: Ensure Kolla container images are built
shell:
cmd: >
set -o pipefail &&
. {{ kolla_venv }}/bin/activate &&
kolla-build
--config-dir {{ kolla_build_config_path }}
{% if kolla_docker_registry is not none %}--registry {{ kolla_docker_registry }}{% endif %}
{% if push_images | bool %}--push{% endif %}
{% if nocache | bool %}--nocache{% endif %}
{{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }}
executable: /bin/bash
with_items: "{{ container_image_sets }}"
when: item.regexes != ''