From ebf8cfca628e92fa198d6cb304b5cafa17f7824a Mon Sep 17 00:00:00 2001
From: Michal Nasiadka <mnasiadka@gmail.com>
Date: Wed, 20 Jul 2022 14:25:18 +0200
Subject: [PATCH] Add support for Ubuntu Jammy Jellyfish (22.04) LTS

Co-Authored-By: Bartosz Bezak <bartosz@stackhpc.com>

Change-Id: I06a3e9922cf95979f3bca120cd82633046270fa3
---
 ansible/group_vars/all/apt                    |  2 +-
 ansible/group_vars/all/globals                |  4 ++--
 ansible/group_vars/all/infra-vms              |  4 ++--
 ansible/group_vars/all/seed-vm                |  4 ++--
 ansible/roles/apt/defaults/main.yml           |  2 +-
 ansible/roles/apt/tasks/repos.yml             |  9 +++++++
 doc/source/configuration/reference/hosts.rst  | 12 +++++-----
 .../reference/os-distribution.rst             |  2 +-
 doc/source/installation.rst                   |  2 +-
 doc/source/resources.rst                      |  2 +-
 doc/source/support-matrix.rst                 |  2 +-
 etc/kayobe/apt.yml                            |  2 +-
 etc/kayobe/globals.yml                        |  2 +-
 etc/kayobe/infra-vms.yml                      |  2 +-
 etc/kayobe/seed-vm.yml                        |  2 +-
 .../overrides.yml.j2                          |  8 +++----
 .../notes/ubuntu-jammy-515047cd1ae85151.yaml  |  5 ++++
 zuul.d/jobs.yaml                              | 24 +++++++++----------
 zuul.d/nodesets.yaml                          |  4 ++--
 zuul.d/project.yaml                           | 22 ++++++++---------
 20 files changed, 65 insertions(+), 51 deletions(-)
 create mode 100644 releasenotes/notes/ubuntu-jammy-515047cd1ae85151.yaml

diff --git a/ansible/group_vars/all/apt b/ansible/group_vars/all/apt
index 46d26de1..904e0517 100644
--- a/ansible/group_vars/all/apt
+++ b/ansible/group_vars/all/apt
@@ -30,7 +30,7 @@ apt_keys: []
 # * types: whitespace-separated list of repository types, e.g. deb or deb-src
 #   (optional, default is 'deb')
 # * url: URL of the repository
-# * suites: whitespace-separated list of suites, e.g. focal (optional, default
+# * suites: whitespace-separated list of suites, e.g. jammy (optional, default
 #   is ansible_facts.distribution_release)
 # * components: whitespace-separated list of components, e.g. main (optional,
 #   default is 'main')
diff --git a/ansible/group_vars/all/globals b/ansible/group_vars/all/globals
index f84c60c3..f3d4cdd3 100644
--- a/ansible/group_vars/all/globals
+++ b/ansible/group_vars/all/globals
@@ -49,12 +49,12 @@ kayobe_ansible_user: "stack"
 os_distribution: "centos"
 
 # OS release. Valid options are "8-stream" when os_distribution is "centos", or
-# "8" when os_distribution is "rocky", or "focal" when os_distribution is
+# "8" when os_distribution is "rocky", or "jammy" when os_distribution is
 # "ubuntu".
 os_release: >-
   {{ '8-stream' if os_distribution == 'centos'
   else '8' if os_distribution == 'rocky'
-  else 'focal' }}
+  else 'jammy' }}
 
 ###############################################################################
 # Ansible configuration.
diff --git a/ansible/group_vars/all/infra-vms b/ansible/group_vars/all/infra-vms
index 859eb046..beacc89d 100644
--- a/ansible/group_vars/all/infra-vms
+++ b/ansible/group_vars/all/infra-vms
@@ -41,7 +41,7 @@ infra_vm_root_capacity: 50G
 infra_vm_root_format: qcow2
 
 # Base image for the infra VM root volume. Default is
-# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
+# "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
 # when os_distribution is "ubuntu", or
 # http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
 # when os_distribution is "rocky",
@@ -50,7 +50,7 @@ infra_vm_root_format: qcow2
 # otherwise.
 infra_vm_root_image: >-
   {%- if os_distribution == 'ubuntu' %}
-  https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
+  https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
   {%- elif os_distribution == 'rocky' %}
   http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
   {%- else -%}
diff --git a/ansible/group_vars/all/seed-vm b/ansible/group_vars/all/seed-vm
index fb865840..678285cd 100644
--- a/ansible/group_vars/all/seed-vm
+++ b/ansible/group_vars/all/seed-vm
@@ -41,7 +41,7 @@ seed_vm_root_capacity: 50G
 seed_vm_root_format: qcow2
 
 # Base image for the seed VM root volume. Default is
-# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
+# "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
 # when os_distribution is "ubuntu",
 # http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
 # when os_distribution is "rocky",
@@ -50,7 +50,7 @@ seed_vm_root_format: qcow2
 # otherwise.
 seed_vm_root_image: >-
   {%- if os_distribution == 'ubuntu' %}
-  https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
+  https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
   {%- elif os_distribution == 'rocky' %}
   http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
   {%- else -%}
diff --git a/ansible/roles/apt/defaults/main.yml b/ansible/roles/apt/defaults/main.yml
index f818381d..39013cd6 100644
--- a/ansible/roles/apt/defaults/main.yml
+++ b/ansible/roles/apt/defaults/main.yml
@@ -33,7 +33,7 @@ apt_keys: []
 # * types: whitespace-separated list of repository types, e.g. deb or deb-src
 #   (optional, default is 'deb')
 # * url: URL of the repository
-# * suites: whitespace-separated list of suites, e.g. focal (optional, default
+# * suites: whitespace-separated list of suites, e.g. jammy (optional, default
 #   is ansible_facts.distribution_release)
 # * components: whitespace-separated list of components, e.g. main (optional,
 #   default is 'main')
diff --git a/ansible/roles/apt/tasks/repos.yml b/ansible/roles/apt/tasks/repos.yml
index 8f48f2b9..b63139e7 100644
--- a/ansible/roles/apt/tasks/repos.yml
+++ b/ansible/roles/apt/tasks/repos.yml
@@ -1,4 +1,13 @@
 ---
+- name: Ensure the Apt sources.list.d directory exists
+  file:
+    path: "/etc/apt/sources.list.d"
+    state: directory
+    owner: root
+    group: root
+    mode: 0755
+  become: true
+
 # NOTE(mgoddard): Use the modern deb822 repository format rather than the old
 # format used by the apt_repository module.
 - name: Configure apt repositories
diff --git a/doc/source/configuration/reference/hosts.rst b/doc/source/configuration/reference/hosts.rst
index 4cb6e57a..660141cb 100644
--- a/doc/source/configuration/reference/hosts.rst
+++ b/doc/source/configuration/reference/hosts.rst
@@ -366,7 +366,7 @@ items:
 * ``types``: whitespace-separated list of repository types, e.g. ``deb`` or
   ``deb-src`` (optional, default is ``deb``)
 * ``url``: URL of the repository
-* ``suites``: whitespace-separated list of suites, e.g. ``focal`` (optional,
+* ``suites``: whitespace-separated list of suites, e.g. ``jammy`` (optional,
   default is ``ansible_facts.distribution_release``)
 * ``components``: whitespace-separated list of components, e.g. ``main``
   (optional, default is ``main``)
@@ -385,10 +385,10 @@ For example, the following configuration defines a single Apt repository:
    apt_repositories:
      - types: deb
        url: https://example.com/repo
-       suites: focal
+       suites: jammy
        components: all
 
-In the following example, the Ubuntu Focal 20.04 repositories are consumed from
+In the following example, the Ubuntu Jammy 22.04 repositories are consumed from
 a local package mirror. The ``apt_disable_sources_list`` variable is set to
 ``true``, which disables all repositories in ``/etc/apt/sources.list``,
 including the default Ubuntu ones.
@@ -398,10 +398,10 @@ including the default Ubuntu ones.
 
    apt_repositories:
      - url: http://mirror.example.com/ubuntu/
-       suites: focal focal-updates
+       suites: jammy jammy-updates
        components: main restricted universe multiverse
      - url: http://mirror.example.com/ubuntu/
-       suites: focal-security
+       suites: jammy-security
        components: main restricted universe multiverse
 
    apt_disable_sources_list: true
@@ -438,7 +438,7 @@ that is signed by the key.
    apt_repositories:
      - types: deb
        url: https://example.com/repo
-       suites: focal
+       suites: jammy
        components: all
        signed_by: example-key.asc
 
diff --git a/doc/source/configuration/reference/os-distribution.rst b/doc/source/configuration/reference/os-distribution.rst
index f73524f3..a64fd23c 100644
--- a/doc/source/configuration/reference/os-distribution.rst
+++ b/doc/source/configuration/reference/os-distribution.rst
@@ -16,7 +16,7 @@ or ``rocky`` or ``ubuntu``, and defaults to ``centos``.
 The ``os_release`` variable in ``etc/kayobe/globals.yml`` can be used to set
 the release of the OS. When ``os_distribution`` is set to ``centos`` it may be
 set to ``8-stream``, and this is its default value. When ``os_distribution`` is
-set to ``ubuntu`` it may be set to ``focal``, and this is its default value.
+set to ``ubuntu`` it may be set to ``jammy``, and this is its default value.
 When ``os_distribution`` is set to ``rocky`` it may be set to ``8``, and this
 is its default value.
 
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
index acf86eac..0d0ebeea 100644
--- a/doc/source/installation.rst
+++ b/doc/source/installation.rst
@@ -17,7 +17,7 @@ control host:
 
 - CentOS Stream 8 (since Wallaby 10.0.0 release)
 - Rocky Linux 8 (since Yoga 12.0.0 release)
-- Ubuntu Focal 20.04 (since Wallaby 10.0.0 release)
+- Ubuntu Jammy 22.04 (since Zed 13.0.0 release)
 
 See the :doc:`support matrix <support-matrix>` for details of supported
 Operating Systems for other hosts.
diff --git a/doc/source/resources.rst b/doc/source/resources.rst
index c3011b74..bb41396e 100644
--- a/doc/source/resources.rst
+++ b/doc/source/resources.rst
@@ -22,7 +22,7 @@ OpenStack using Kolla, Ansible and Kayobe. The guide makes use of
 baremetal environment running on a single hypervisor.
 
 To complete the walkthrough you will require a baremetal or VM hypervisor
-running CentOS 8 or Ubuntu Focal 20.04 (since Wallaby 10.0.0) with at least
+running CentOS 8 or Ubuntu Jammy 22.04 (since Zed 13.0.0) with at least
 32GB RAM & 80GB disk space.  Preparing the deployment can take some time -
 where possible it is beneficial to snapshot the hypervisor. We advise making a
 snapshot after creating the initial 'seed' VM as this will make additional
diff --git a/doc/source/support-matrix.rst b/doc/source/support-matrix.rst
index 3b18d665..35ec7765 100644
--- a/doc/source/support-matrix.rst
+++ b/doc/source/support-matrix.rst
@@ -11,7 +11,7 @@ Kayobe supports the following host Operating Systems (OS):
 
 * CentOS Stream 8 (since Wallaby 10.0.0 release)
 * Rocky Linux 8 (since Yoga 12.0.0 release)
-* Ubuntu Focal 20.04 (since Wallaby 10.0.0 release)
+* Ubuntu Jammy 22.04 (since Zed 13.0.0 release)
 
 .. note::
 
diff --git a/etc/kayobe/apt.yml b/etc/kayobe/apt.yml
index 34bfdd2e..9a9d8853 100644
--- a/etc/kayobe/apt.yml
+++ b/etc/kayobe/apt.yml
@@ -30,7 +30,7 @@
 # * types: whitespace-separated list of repository types, e.g. deb or deb-src
 #   (optional, default is 'deb')
 # * url: URL of the repository
-# * suites: whitespace-separated list of suites, e.g. focal (optional, default
+# * suites: whitespace-separated list of suites, e.g. jammy (optional, default
 #   is ansible_facts.distribution_release)
 # * components: whitespace-separated list of components, e.g. main (optional,
 #   default is 'main')
diff --git a/etc/kayobe/globals.yml b/etc/kayobe/globals.yml
index b926fc9b..85f668d1 100644
--- a/etc/kayobe/globals.yml
+++ b/etc/kayobe/globals.yml
@@ -50,7 +50,7 @@
 #os_distribution:
 
 # OS release. Valid options are "8-stream" when os_distribution is "centos", or
-# "8" when os_distribution is "rocky", or "focal" when os_distribution is
+# "8" when os_distribution is "rocky", or "jammy" when os_distribution is
 # "ubuntu".
 #os_release:
 
diff --git a/etc/kayobe/infra-vms.yml b/etc/kayobe/infra-vms.yml
index 3274ed80..1ec28d9d 100644
--- a/etc/kayobe/infra-vms.yml
+++ b/etc/kayobe/infra-vms.yml
@@ -30,7 +30,7 @@
 #infra_vm_root_format:
 
 # Base image for the infra VM root volume. Default is
-# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
+# "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
 # when os_distribution is "ubuntu", or
 # http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
 # when os_distribution is "rocky",
diff --git a/etc/kayobe/seed-vm.yml b/etc/kayobe/seed-vm.yml
index f8c2ab8a..4b826497 100644
--- a/etc/kayobe/seed-vm.yml
+++ b/etc/kayobe/seed-vm.yml
@@ -24,7 +24,7 @@
 #seed_vm_root_format:
 
 # Base image for the seed VM root volume. Default is
-# "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
+# "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
 # when os_distribution is "ubuntu",
 # http://dl.rockylinux.org/pub/rocky/8.5/images/Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
 # when os_distribution is "rocky",
diff --git a/playbooks/kayobe-overcloud-host-configure-base/overrides.yml.j2 b/playbooks/kayobe-overcloud-host-configure-base/overrides.yml.j2
index fed31514..7e926513 100644
--- a/playbooks/kayobe-overcloud-host-configure-base/overrides.yml.j2
+++ b/playbooks/kayobe-overcloud-host-configure-base/overrides.yml.j2
@@ -123,15 +123,15 @@ apt_keys:
   - url: https://packages.treasuredata.com/GPG-KEY-td-agent
     filename: td-agent.asc
 apt_repositories:
-  # Ubuntu focal repositories.
+  # Ubuntu jammy repositories.
   - url: "http://{{ zuul_site_mirror_fqdn }}/ubuntu/"
-    suites: focal focal-updates
+    suites: jammy jammy-updates
     components: main restricted universe multiverse
   - url: "http://{{ zuul_site_mirror_fqdn }}/ubuntu/"
-    suites: focal-security
+    suites: jammy-security
     components: main restricted universe multiverse
   # Treasuredata repository.
-  - url:  http://packages.treasuredata.com/4/ubuntu/focal/
+  - url:  http://packages.treasuredata.com/4/ubuntu/jammy/
     components: contrib
     signed_by: td-agent.asc
 apt_disable_sources_list: true
diff --git a/releasenotes/notes/ubuntu-jammy-515047cd1ae85151.yaml b/releasenotes/notes/ubuntu-jammy-515047cd1ae85151.yaml
new file mode 100644
index 00000000..e937d666
--- /dev/null
+++ b/releasenotes/notes/ubuntu-jammy-515047cd1ae85151.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Adds support for Ubuntu Jammy Jellyfish (22.04) LTS as a host and
+    container Operating System for seed, seed hypervisor and overcloud hosts.
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 66042c06..6d2c63ee 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -124,9 +124,9 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-overcloud-ubuntu-focal
+    name: kayobe-overcloud-ubuntu-jammy
     parent: kayobe-overcloud-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
 
 - job:
     name: kayobe-overcloud-tls-base
@@ -186,9 +186,9 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-seed-ubuntu-focal
+    name: kayobe-seed-ubuntu-jammy
     parent: kayobe-seed-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
 
 - job:
     name: kayobe-seed-images-base
@@ -212,9 +212,9 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-seed-images-ubuntu-focal
+    name: kayobe-seed-images-ubuntu-jammy
     parent: kayobe-seed-images-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
 
 - job:
     name: kayobe-overcloud-host-configure-base
@@ -238,9 +238,9 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-overcloud-host-configure-ubuntu-focal
+    name: kayobe-overcloud-host-configure-ubuntu-jammy
     parent: kayobe-overcloud-host-configure-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
 
 - job:
     name: kayobe-seed-upgrade-base
@@ -287,9 +287,9 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-seed-vm-ubuntu-focal
+    name: kayobe-seed-vm-ubuntu-jammy
     parent: kayobe-seed-vm-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
 
 - job:
     name: kayobe-infra-vm-base
@@ -314,6 +314,6 @@
     nodeset: kayobe-rocky8
 
 - job:
-    name: kayobe-infra-vm-ubuntu-focal
+    name: kayobe-infra-vm-ubuntu-jammy
     parent: kayobe-infra-vm-base
-    nodeset: kayobe-ubuntu-focal
+    nodeset: kayobe-ubuntu-jammy
diff --git a/zuul.d/nodesets.yaml b/zuul.d/nodesets.yaml
index b20e1bde..697c6c10 100644
--- a/zuul.d/nodesets.yaml
+++ b/zuul.d/nodesets.yaml
@@ -13,7 +13,7 @@
         label: rockylinux-8
 
 - nodeset:
-    name: kayobe-ubuntu-focal
+    name: kayobe-ubuntu-jammy
     nodes:
       - name: primary
-        label: ubuntu-focal
+        label: ubuntu-jammy
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index 7975ef3e..2b843ff9 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -13,25 +13,25 @@
         - kayobe-tox-molecule
         - kayobe-overcloud-centos8s
         - kayobe-overcloud-rocky8
-        - kayobe-overcloud-ubuntu-focal
+        - kayobe-overcloud-ubuntu-jammy
         - kayobe-overcloud-tls-centos8s
         - kayobe-overcloud-host-configure-centos8s
         - kayobe-overcloud-host-configure-rocky8
-        - kayobe-overcloud-host-configure-ubuntu-focal
+        - kayobe-overcloud-host-configure-ubuntu-jammy
         - kayobe-overcloud-upgrade-centos8s
         - kayobe-overcloud-upgrade-ubuntu-focal
         - kayobe-seed-centos8s
         - kayobe-seed-rocky8
-        - kayobe-seed-ubuntu-focal
+        - kayobe-seed-ubuntu-jammy
         - kayobe-seed-images-centos8s
         - kayobe-seed-upgrade-centos8s
         - kayobe-seed-upgrade-ubuntu-focal
         - kayobe-seed-vm-centos8s
         - kayobe-seed-vm-rocky8
-        - kayobe-seed-vm-ubuntu-focal
+        - kayobe-seed-vm-ubuntu-jammy
         - kayobe-infra-vm-centos8s
         - kayobe-infra-vm-rocky8
-        - kayobe-infra-vm-ubuntu-focal
+        - kayobe-infra-vm-ubuntu-jammy
 
     gate:
       jobs:
@@ -40,26 +40,26 @@
         - kayobe-tox-molecule
         - kayobe-overcloud-centos8s
         - kayobe-overcloud-rocky8
-        - kayobe-overcloud-ubuntu-focal
+        - kayobe-overcloud-ubuntu-jammy
         - kayobe-overcloud-tls-centos8s
         - kayobe-overcloud-host-configure-centos8s
         - kayobe-overcloud-host-configure-rocky8
-        - kayobe-overcloud-host-configure-ubuntu-focal
+        - kayobe-overcloud-host-configure-ubuntu-jammy
         - kayobe-overcloud-upgrade-centos8s
         - kayobe-overcloud-upgrade-ubuntu-focal
         - kayobe-seed-centos8s
         - kayobe-seed-rocky8
-        - kayobe-seed-ubuntu-focal
+        - kayobe-seed-ubuntu-jammy
         - kayobe-seed-upgrade-centos8s
         - kayobe-seed-upgrade-ubuntu-focal
         - kayobe-seed-vm-centos8s
         - kayobe-seed-vm-rocky8
-        - kayobe-seed-vm-ubuntu-focal
+        - kayobe-seed-vm-ubuntu-jammy
         - kayobe-infra-vm-centos8s
         - kayobe-infra-vm-rocky8
-        - kayobe-infra-vm-ubuntu-focal
+        - kayobe-infra-vm-ubuntu-jammy
 
     experimental:
       jobs:
         - kayobe-seed-images-rocky8
-        - kayobe-seed-images-ubuntu-focal
+        - kayobe-seed-images-ubuntu-jammy
-- 
GitLab