From: David Galloway Date: Tue, 1 Jul 2025 13:06:07 +0000 (-0400) Subject: cobbler: Rocky 10 support X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9c2c7e1ee4b08f7026fd05be3f8871f895de7043;p=ceph-cm-ansible.git cobbler: Rocky 10 support - no gdisk in base repos - `clearpart --all --initlabel` now defaults to GPT. However, we have been using msdos and a single partition on testnodes since forever. FOG seemed to have trouble with GPT partitions. - /etc/sysconfig/network-scripts are no longer used in Rocky 10. Replaced with nmcli commands during rc.local boot Signed-off-by: David Galloway --- diff --git a/cobbler.yml b/cobbler.yml index f0b2709..dce9816 100644 --- a/cobbler.yml +++ b/cobbler.yml @@ -50,6 +50,7 @@ - { role: cobbler_profile, distro_name: CentOS-8.stream-x86_64, tags: ['centos8.stream'] } - { role: cobbler_profile, distro_name: CentOS-9.stream-x86_64, tags: ['centos9.stream'] } - { role: cobbler_profile, distro_name: Rocky-9.5-x86_64, tags: ['rocky9.5'] } + - { role: cobbler_profile, distro_name: Rocky-10.0-x86_64, tags: ['rocky10.0'] } - { 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'] } diff --git a/roles/cobbler/templates/kickstarts/cephlab_rhel.ks b/roles/cobbler/templates/kickstarts/cephlab_rhel.ks index 359dfcb..9c683f6 100644 --- a/roles/cobbler/templates/kickstarts/cephlab_rhel.ks +++ b/roles/cobbler/templates/kickstarts/cephlab_rhel.ks @@ -4,7 +4,7 @@ # do not use with earlier distros #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] #end if diff --git a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdc.ks b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdc.ks index 725df30..e5f68cb 100644 --- a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdc.ks +++ b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdc.ks @@ -5,7 +5,7 @@ # do not use with earlier distros #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] #end if diff --git a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdi.ks b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdi.ks index 0eca255..63f5a59 100644 --- a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdi.ks +++ b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdi.ks @@ -5,7 +5,7 @@ # do not use with earlier distros #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] #end if diff --git a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdm.ks b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdm.ks index f5f8e98..6c9a9eb 100644 --- a/roles/cobbler/templates/kickstarts/cephlab_rhel_sdm.ks +++ b/roles/cobbler/templates/kickstarts/cephlab_rhel_sdm.ks @@ -5,7 +5,7 @@ # do not use with earlier distros #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] #end if diff --git a/roles/cobbler/templates/snippets/cephlab_packages_rhel b/roles/cobbler/templates/snippets/cephlab_packages_rhel index e83fabf..f78ea83 100644 --- a/roles/cobbler/templates/snippets/cephlab_packages_rhel +++ b/roles/cobbler/templates/snippets/cephlab_packages_rhel @@ -10,7 +10,7 @@ python3 #else @base #end if -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] ## These packages are available in all RHEL/CentOS versions but not Fedora @@ -53,4 +53,6 @@ ethtool wget smartmontools selinux-policy-targeted +#if $distro != 'Rocky' gdisk +#end if diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index 6705c5c..578160d 100644 --- a/roles/cobbler/templates/snippets/cephlab_rc_local +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -3,12 +3,12 @@ # Set proper location for firstboot ansible post-install trigger #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if ($distro == 'RHEL') or ($distro == 'CentOS') +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver = $distro_ver.split(".")[0] #end if #if ($distro == 'Fedora' and int($distro_ver) >= 22) or ($distro == 'RHEL' and int($distro_ver) >= 8) #set script = '/etc/rc.d/rc.local' -#else if $distro == 'CentOS' and int($distro_ver) >= 9 +#else if ($distro in ['CentOS', 'Rocky']) and int($distro_ver) >= 9 #set script = '/etc/rc.d/rc.local' systemctl enable rc-local.service #else if $distro == 'openSUSE' @@ -57,7 +57,12 @@ if [ ! -f /.cephlab_net_configured ]; then elif command -v apt-get &>/dev/null; then echo -e "auto lo\niface lo inet loopback\n\nauto $nic\niface $nic inet dhcp" > /etc/network/interfaces else - echo -e "DEVICE=$nic\nBOOTPROTO=dhcp\nONBOOT=yes" > /etc/sysconfig/network-scripts/ifcfg-$nic + etcsysconfig=true + if ! echo -e "DEVICE=$nic\nBOOTPROTO=dhcp\nONBOOT=yes" > /etc/sysconfig/network-scripts/ifcfg-$nic; then + etcsysconfig=false + nmcli con add type ethernet ifname $nic con-name $nic ipv4.method auto + nmcli con up $nic + fi fi # Don't bail if NIC fails to go down or come up { set +e; } 2>/dev/null @@ -77,7 +82,11 @@ if [ ! -f /.cephlab_net_configured ]; then # If we can't ping our Cobbler host, remove the DHCP config for this NIC. # It must either be on a non-routable network or has no reachable DHCP server. ifdown $nic - rm -f /etc/sysconfig/network-scripts/ifcfg-$nic + if [ "$etcsysconfig" ]; then + rm -f /etc/sysconfig/network-scripts/ifcfg-$nic + else + nmcli connection delete $nic + fi sed -i "/$nic/d" /etc/network/interfaces # Go back to bailing if anything fails bringing the next NIC up set -e diff --git a/roles/cobbler/templates/snippets/cephlab_rhel_disks b/roles/cobbler/templates/snippets/cephlab_rhel_disks index 0c9425a..b663d41 100644 --- a/roles/cobbler/templates/snippets/cephlab_rhel_disks +++ b/roles/cobbler/templates/snippets/cephlab_rhel_disks @@ -3,12 +3,16 @@ # #set hostname = $getVar('name','') #set distro = $getVar('distro','').split("-")[0] #set distro_ver = $getVar('distro','').split("-")[1] -#if $distro == 'RHEL' or $distro == 'CentOS' +#if $distro in ['RHEL', 'CentOS', 'Rocky'] #set distro_ver_major = $distro_ver.split(".")[0] #set distro_ver_minor = $distro_ver.split(".")[1] #end if # Partition clearing information +#if $distro == 'Rocky' and int($distro_ver_major) >= 10 +clearpart --all --disklabel msdos +#else clearpart --all --initlabel +#end if # Use all of /dev/sda for the root partition (20G minimum) part / --fstype="ext4" --ondisk=sda --size=20000 --grow # Clear the Master Boot Record diff --git a/roles/cobbler_profile/defaults/main.yml b/roles/cobbler_profile/defaults/main.yml index 02c14b8..82b6354 100644 --- a/roles/cobbler_profile/defaults/main.yml +++ b/roles/cobbler_profile/defaults/main.yml @@ -145,6 +145,11 @@ distros: iso: https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.5-x86_64-dvd.iso sha256: ba60c3653640b5747610ddfb4d09520529bef2d1d83c1feb86b0c84dff31e04e kickstart: cephlab_rhel.ks + "Rocky-10.0-x86_64": + iso: https://download.rockylinux.org/pub/rocky/10/isos/x86_64/Rocky-10.0-x86_64-dvd1.iso + sha256: 678ea3e1eea6f5d6c220c46fab34f5e0add260e7b64f0139ee3b9f7b7ca7d2f3 + kickstart: cephlab_rhel.ks + kernel_options: "inst.ks=http://@@http_server@@/cblr/svc/op/ks/system/@@name@@" "Ubuntu-12.04-server-x86_64": iso: "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso" sha256: af224223de99e2a730b67d7785b657f549be0d63221188e105445f75fb8305c9