From 1cac2ccbc85e9ce395de11bb40662684ea4b91ee Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Fri, 30 Apr 2021 16:37:52 +0100
Subject: [PATCH] Add os_release variable, build CentOS stream images

* add os_release variable
* build CentOS stream overcloud root disk images
* build CentOS stream IPA images

Story: 2008795
Task: 42417

Change-Id: I3d231076052fbfa8416f34c038c02fd10a1c37f2
---
 ansible/group_vars/all/bifrost                           | 5 ++---
 ansible/group_vars/all/globals                           | 4 ++++
 ansible/group_vars/all/ipa                               | 4 ++++
 etc/kayobe/bifrost.yml                                   | 3 +--
 etc/kayobe/globals.yml                                   | 4 ++++
 releasenotes/notes/os-distribution-69445eb19a611d43.yaml | 5 ++++-
 6 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/ansible/group_vars/all/bifrost b/ansible/group_vars/all/bifrost
index d26c9c86..ee9bef43 100644
--- a/ansible/group_vars/all/bifrost
+++ b/ansible/group_vars/all/bifrost
@@ -21,9 +21,8 @@ kolla_bifrost_firewalld_internal_zone: trusted
 # DIB base OS element. Default is {{ os_distribution }}.
 kolla_bifrost_dib_os_element: "{{ os_distribution }}"
 
-# DIB image OS release. Default is "focal" when os_distribution is "ubuntu", or
-# "8" otherwise.
-kolla_bifrost_dib_os_release: "{{ 'focal' if os_distribution == 'ubuntu' else '8' }}"
+# DIB image OS release. Default is {{ os_release }}.
+kolla_bifrost_dib_os_release: "{{ os_release }}"
 
 # List of default DIB elements. Default is ["disable-selinux",
 # "enable-serial-console", "vm"] when os_distribution is "centos", or
diff --git a/ansible/group_vars/all/globals b/ansible/group_vars/all/globals
index 9d9d6e31..f6cad0af 100644
--- a/ansible/group_vars/all/globals
+++ b/ansible/group_vars/all/globals
@@ -47,3 +47,7 @@ kayobe_ansible_user: "stack"
 # OS distribution name. Valid options are "centos", "ubuntu". Default is
 # "centos".
 os_distribution: "centos"
+
+# OS release. Valid options are "8-stream" when os_distribution is "centos", or
+# "focal" when os_distribution is "ubuntu".
+os_release: "{{ '8-stream' if os_distribution == 'centos' else 'focal' }}"
diff --git a/ansible/group_vars/all/ipa b/ansible/group_vars/all/ipa
index ef819ec5..77bae9f9 100644
--- a/ansible/group_vars/all/ipa
+++ b/ansible/group_vars/all/ipa
@@ -23,6 +23,7 @@ ipa_builder_source_version: master
 # images. Default is ["centos", "enable-serial-console",
 # "ironic-python-agent-ramdisk"].
 ipa_build_dib_elements_default:
+  # TODO(mgoddard): Use {{ os_distribution }} here when Ubuntu IPA builds work.
   - centos
   - enable-serial-console
   - ironic-python-agent-ramdisk
@@ -41,6 +42,9 @@ ipa_build_dib_elements: >
 # Dictionary of default environment variables to provide to Diskimage Builder
 # (DIB) during IPA image build.
 ipa_build_dib_env_default:
+  # TODO(mgoddard): Use {{ os_release }} here when we use os_distribution
+  # above.
+  DIB_RELEASE: "8-stream"
   DIB_REPOLOCATION_ironic_agent: "{{ ipa_build_source_url }}"
   DIB_REPOREF_ironic_agent: "{{ ipa_build_source_version }}"
 
diff --git a/etc/kayobe/bifrost.yml b/etc/kayobe/bifrost.yml
index 8d20ebeb..91c8bcc5 100644
--- a/etc/kayobe/bifrost.yml
+++ b/etc/kayobe/bifrost.yml
@@ -21,8 +21,7 @@
 # DIB base OS element. Default is {{ os_distribution }}.
 #kolla_bifrost_dib_os_element:
 
-# DIB image OS release. Default is "focal" when os_distribution is "ubuntu", or
-# "8" otherwise.
+# DIB image OS release. Default is {{ os_release }}.
 #kolla_bifrost_dib_os_release:
 
 # List of default DIB elements. Default is ["disable-selinux",
diff --git a/etc/kayobe/globals.yml b/etc/kayobe/globals.yml
index 64290d92..9efc114f 100644
--- a/etc/kayobe/globals.yml
+++ b/etc/kayobe/globals.yml
@@ -49,6 +49,10 @@
 # "centos".
 #os_distribution:
 
+# OS release. Valid options are "8-stream" when os_distribution is "centos", or
+# "focal" when os_distribution is "ubuntu".
+#os_release:
+
 ###############################################################################
 # Dummy variable to allow Ansible to accept this file.
 workaround_ansible_issue_8743: yes
diff --git a/releasenotes/notes/os-distribution-69445eb19a611d43.yaml b/releasenotes/notes/os-distribution-69445eb19a611d43.yaml
index 69c1f881..df8e8d2d 100644
--- a/releasenotes/notes/os-distribution-69445eb19a611d43.yaml
+++ b/releasenotes/notes/os-distribution-69445eb19a611d43.yaml
@@ -3,7 +3,10 @@ features:
   - |
     Adds an ``os_distribution`` variable in ``etc/kayobe/globals.yml``, with a
     default value of ``centos``. The variable can also be set to ``ubuntu``,
-    and sets sensible default values for other variables.
+    and sets sensible default values for other variables. Also adds an
+    ``os_release`` variable in the same file, with a default value of
+    ``8-stream`` when ``os_distribution`` is ``centos`` or ``focal`` when
+    ``os_distribution`` is ``ubuntu``.
 upgrade:
   - |
     Modifies the default value of ``controller_bootstrap_user``,
-- 
GitLab