Sandeep Yadav 4a83b740d7 Add role to discover Centos latest images
With this patch, we are adding a new role discover-latest-image to
discover the latest Centos Stream image, We are limiting the scope
for C9 for now, We can extend the role for Centos 8 image discovery
in future if there is a need.

Also, we are updating baremetal-prep-virthost.yml playbook to use
this new role for c9 case and in combination with patch[1] - we will
get rid of undercloud baseos hardcoding and use the latest discovered
image.

[1] https://review.opendev.org/c/openstack/tripleo-quickstart/+/838990/

Change-Id: I3a97edc63e96725a1690335f557508d56ed10258
2022-06-20 16:10:38 +05:30
..

Role Name

An Ansible role to discover latest Centos image.

Requirements

This role is currently written for Centos-9 and can be extended to Centos-8 on need basis.

Role Variables

  • base_url: <https://cloud.centos.org/centos/{{ ansible_distribution_major_version }}-stream/x86_64/images/> Base Url from where we can pull the Centos Image.
  • qcow_prefix: Qcow2 image prefix on base_url which will be used as a filter to find latest Centos Image.

Example Playbook

  1. Sample playbook to call the role
- name: Discover latest CentOS qcow2 image
  include_role:
    name: discover-latest-image
  1. Sample config to use the facts from discover-latest-image
- name: set_fact for undercloud base image
  set_fact:
    baseos_undercloud_image_url: "{{ discovered_image_url }}"
    baseos_image: "{{ ansible_distribution | lower }}"
    baseos_image_type: qcow2
    baseos_md5sum: "{{ discovered_md5sum }} {{ discovered_image_name }}"
    cacheable: true