]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Support CentOS Stream 621/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 12 May 2021 20:37:24 +0000 (16:37 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 18 May 2021 15:06:23 +0000 (11:06 -0400)
"But David, why aren't we just using the CentOS 8 Stream ISO?"

Thank you for asking.
1) The vmlinuz and initrd that are baked into the CentOS 8 Stream ISO as of this writing are not compatible.  Filed https://bugs.centos.org/view.php?id=18188
2) Even if I take the vmlinuz and initrd from CentOS 8.3, after firstboot, the system still bizarrely boots as CentOS 8.3.  That's right, when using the CentOS 8 Stream ISO and we kickstart using Cobbler, you end up with CentOS 8.3.  I'm sure it has something to do with our kickstarts and snippets but nothing obvious stood out to me.

Signed-off-by: David Galloway <dgallowa@redhat.com>
cobbler.yml
roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh
roles/cobbler_profile/defaults/main.yml
roles/cobbler_profile/tasks/import_distro.yml
roles/cobbler_profile/tasks/import_stream_profile.yml [new file with mode: 0644]
roles/testnode/tasks/yum/repos.yml
roles/testnode/templates/mirrorlists/8/CentOS-AppStream-mirrorlist
roles/testnode/templates/mirrorlists/8/CentOS-Base-mirrorlist
roles/testnode/templates/mirrorlists/8/CentOS-Extras-mirrorlist
roles/testnode/vars/yum_systems.yml
tools/convert-to-centos-stream.yml [new file with mode: 0644]

index ed4ac70e71e0e898059b7595dbf8f606d121e4da..834ee4f7b4a0480c0e2c198fe76b99b730b03dae 100644 (file)
@@ -40,6 +40,7 @@
     - { role: cobbler_profile, distro_name: CentOS-8.1-aarch64, tags: ['centos8.1-aarch64'] }
     - { role: cobbler_profile, distro_name: CentOS-8.2-x86_64, tags: ['centos8.2'] }
     - { role: cobbler_profile, distro_name: CentOS-8.3-x86_64, tags: ['centos8.3'] }
+    - { role: cobbler_profile, distro_name: CentOS-8.stream-x86_64, tags: ['centos8.stream'] }
     - { role: cobbler_profile, distro_name: Ubuntu-12.04-server-x86_64, tags: ['ubuntu-precise'] }
     - { role: cobbler_profile, distro_name: Ubuntu-14.04-server-x86_64, tags: ['ubuntu-trusty'] }
     - { role: cobbler_profile, distro_name: Ubuntu-15.04-server-x86_64, tags: ['ubuntu-vivid'] }
index cc3ac9cfbdee69a6a331dca379e69f8c25dc6368..1baf9ffe2662c32d2a6c7f80133f8790cfc2ac8a 100644 (file)
@@ -37,6 +37,9 @@ ansible-playbook testnodes.yml -v --limit $name* --tags user,pubkeys,zap 2>&1 >
 if [[ $profile == *"-stock" ]]
 then
     exit 0
+elif [[ $profile == *"8.stream"* ]]
+then
+    ansible-playbook tools/convert-to-centos-stream.yml -v --limit $name* 2>&1 >> /var/log/ansible/$name.log
 fi
 ansible-playbook testnodes.yml -v --limit $name* --skip-tags user,pubkeys,zap 2>&1 >> /var/log/ansible/$name.log &
 popd
index dab84fb2731191c6ebcd8fadee7ba035cb8401c9..3f35308458f03eccc409f06868a2a631e0e065ef 100644 (file)
@@ -42,6 +42,8 @@ distros:
       iso: ""
   "RHEL-8.3-Server-x86_64":
       iso: ""
+  "CentOS-8.stream-x86_64":
+      iso: ""
   "Fedora-22-Server-x86_64":
       iso: http://ftp.linux.ncsu.edu/mirror/ftp.redhat.com/pub/fedora/linux/releases/22/Server/x86_64/iso/Fedora-Server-DVD-x86_64-22.iso
       sha256: b2acfa7c7c6b5d2f51d3337600c2e52eeaa1a1084991181c28ca30343e52e0df
index b0d5ad611b3990fa6c88f3e2e729a1b72c775655..af3e24474cbbd5bd60b4586c7c6fef5f4b7d0588 100644 (file)
   changed_when: false
 
 - import_tasks: import_distro_iso.yml
-  when: profile_type|default('') == 'iso'
+  when: profile_type|default('') == 'iso' and not '"stream" in distro_name'
 
 - import_tasks: import_distro_image.yml
   when: profile_type|default('') == 'image'
 
+- import_tasks: import_stream_profile.yml
+  when: '"stream" in distro_name'
+
 # If either the profile already existed or we successfully imported the
 # distro, we might want to update other options in the profile. i.e. kickstarts
 - name: Set profile_found
diff --git a/roles/cobbler_profile/tasks/import_stream_profile.yml b/roles/cobbler_profile/tasks/import_stream_profile.yml
new file mode 100644 (file)
index 0000000..4220497
--- /dev/null
@@ -0,0 +1,26 @@
+---
+- name: "Extract distro name and major version from {{ distro_name }}"
+  set_fact:
+    distro_and_version: "{{ distro_name.split('.')[0] }}"
+
+- name: "Extract distro name from {{ distro_name }}"
+  set_fact:
+    stream_distro_name: "{{ distro_name.split('-')[0] }}"
+
+- name: "Extract the major version number from {{ distro_and_version }}"
+  set_fact:
+    stream_distro_version: "{{ distro_and_version.split('-')[1] }}"
+
+- name: "Get the latest non-Stream profile that matches this {{ stream_distro_name }} Stream distro version (e.g., CentOS-8.3-x86_64)"
+  shell: "cobbler profile list | grep {{ distro_and_version }} | grep -v 'stream\\|arm\\|aarch\\|stock' | sort -V | tail -n 1 | xargs"
+  register: latest_non_stream_profile
+
+# See commit message for why we do it this way
+- name: "Add {{ distro_name }} to Cobbler as a sub-profile of {{ latest_non_stream_profile.stdout }}"
+  command: "cobbler profile add --name {{ distro_name }} --parent {{ latest_non_stream_profile.stdout }} --clobber"
+  register: imported
+  when: latest_non_stream_profile.stdout_lines|length != 0
+
+# Try importing as an ISO instead if we can't create a sub-profile
+- import_tasks: import_distro_iso.yml
+  when: latest_non_stream_profile.stdout_lines|length == 0
index 278d8d7f6ed0261d899bf7a61adc74d3b42429b8..46d0452edcc5102313ab001f973cb4ed47f6a1ff 100644 (file)
@@ -1,4 +1,19 @@
 ---
+# In non-Stream CentOS versions, ceph-cm-ansible takes care of overwriting the Distro/ISO-provided repo files.
+# Since we convert from CentOS 8.X to CentOS Stream, we have to delete the Stream repo files that the process creates.
+# We just don't want to rely on CentOS' infra to provide our mirror lists.  It has bitten us in the past.
+- name: Clean up Stream distro-provided repos
+  shell: "rm -rvf /etc/yum.repos.d/*Stream*"
+  when:
+    - ansible_lsb.description is defined
+    - '"Stream" in ansible_lsb.description'
+
+- set_fact:
+    dash_stream: "-stream"
+  when:
+    - ansible_lsb.description is defined
+    - '"Stream" in ansible_lsb.description'
+
 - name: Configure local mirrorlists
   template:
     src: 'mirrorlists/{{ ansible_distribution_major_version }}/{{ item }}'
index bdd801c890945e846787e4aaa28692fe3a7939b8..1fa3e678aa7581a639b4eaf19640ba0a3a0ea67b 100644 (file)
@@ -1,7 +1,7 @@
 # {{ ansible_managed }}
 
 # local yum mirrorlist for CentOS-8 - AppStream repo
-https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}/AppStream/x86_64/os/
-http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}/AppStream/x86_64/os/
-http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}/AppStream/x86_64/os/
-http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}/AppStream/x86_64/os/
+https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/AppStream/x86_64/os/
+http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/AppStream/x86_64/os/
+http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/AppStream/x86_64/os/
+http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/AppStream/x86_64/os/
index f345a639c14b0b34b1ff8d2ccfc099960530399f..5711d920bfeb05ffbdb45ad7d161c0ed31f32224 100644 (file)
@@ -1,7 +1,7 @@
 # {{ ansible_managed }}
 
 # local yum mirrorlist for CentOS-8 - Base repo
-https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}/BaseOS/x86_64/os/
-http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}/BaseOS/x86_64/os/
-http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}/BaseOS/x86_64/os/
-http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}/BaseOS/x86_64/os/
+https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/BaseOS/x86_64/os/
+http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/BaseOS/x86_64/os/
+http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/BaseOS/x86_64/os/
+http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/BaseOS/x86_64/os/
index 6edc6ddc7751327a235fadc7cb6eb6f411f02dd5..b83fea3687ac28c9d50659c48551c267e9e7e4b0 100644 (file)
@@ -1,7 +1,7 @@
 # {{ ansible_managed }}
 
 # local yum mirrorlist for CentOS-8 - Extras repo
-https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}/extras/x86_64/os/
-http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}/extras/x86_64/os/
-http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}/extras/x86_64/os/
-http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}/extras/x86_64/os/
+https://download-cc-rdu01.fedoraproject.org/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/extras/x86_64/os/
+http://mirror.linux.duke.edu/pub/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/extras/x86_64/os/
+http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/extras/x86_64/os/
+http://distro.ibiblio.org/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/extras/x86_64/os/
index 56c6d35e72e7a822f1eb7d5313cac3e2669b6dc2..4eee5f094ff797cf00913a810115ffb295cb3fcb 100644 (file)
@@ -43,3 +43,7 @@ ceph_dependency_packages_to_remove:
 
 pip_packages_to_install:
   - remoto>=0.0.35
+
+# This gets defined to "-stream" in roles/testnode/tasks/yum/repos.yml when CentOS Stream is the OS.
+# It adds "-stream" to yum repo mirrorlist URLs.
+dash_stream: ""
diff --git a/tools/convert-to-centos-stream.yml b/tools/convert-to-centos-stream.yml
new file mode 100644 (file)
index 0000000..7a29757
--- /dev/null
@@ -0,0 +1,17 @@
+---
+### This playbook simply converts a CentOS host to CentOS Stream.
+### It is primarily intended to be run during Cobbler's cephlab_ansible.sh post-install trigger.
+
+- hosts:
+    - all
+  become: true
+  gather_facts: true
+  tasks:
+
+  - name: Swap to Stream Repos
+    command: dnf -y swap centos-linux-repos centos-stream-repos
+    when: ansible_distribution == 'CentOS'
+
+  - name: Sync Stream Repos
+    command: dnf -y distro-sync
+    when: ansible_distribution == 'CentOS'