fix: fix almalinux and cloudlinux support

Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
This commit is contained in:
Elkhan Mammadli 2025-03-13 18:48:58 +04:00
parent 39323377ed
commit 05628c2bd2
Signed by: LKHN
GPG Key ID: 846490084013A239
2 changed files with 71 additions and 93 deletions

View File

@ -1,36 +1,26 @@
From 6701ba45d4cc3a888f2275f8f840ce37bc2f4959 Mon Sep 17 00:00:00 2001 From 25dc8023e0bfb131e6e8171e78bb5939a29525e0 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <alukoshko@almalinux.org> From: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
Date: Thu, 13 Mar 2025 14:24:23 +0000 Date: Thu, 13 Mar 2025 18:23:03 +0400
Subject: [PATCH] Improvements for AlmaLinux OS and CloudLinux OS Subject: [PATCH] fix: fix and improve almalinux and cloudlinux support
Add AlmaLinux OS and CloudLinux OS support to: - Fix cc_ntp module.
- Add support to cc_ca_certs module.
- Improve support for systemd integration.
Modules: Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
- cc_ca_certs
- cc_ntp
- cc_resolv_conf
Datasources:
- Rbx Cloud Datasource
Systemd services:
- cloud-final.service
- cloud-init-local.service
- cloud-init.service
--- ---
cloudinit/config/cc_ca_certs.py | 8 ++++ cloudinit/config/cc_ca_certs.py | 8 ++++
cloudinit/config/cc_ntp.py | 11 ++--- cloudinit/config/cc_ntp.py | 3 ++
cloudinit/config/cc_resolv_conf.py | 2 + cloudinit/settings.py | 2 +-
cloudinit/settings.py | 2 +- systemd/cloud-config.service.tmpl | 2 +-
cloudinit/sources/DataSourceRbxCloud.py | 2 +- systemd/cloud-final.service.tmpl | 4 +-
systemd/cloud-final.service.tmpl | 2 +- systemd/cloud-init-local.service.tmpl | 12 ++---
systemd/cloud-init-local.service.tmpl | 10 ++-- systemd/cloud-init.service.tmpl | 4 +-
systemd/cloud-init.service.tmpl | 4 +- templates/chrony.conf.almalinux.tmpl | 51 +++++++++++++++++++++
templates/chrony.conf.almalinux.tmpl | 51 ++++++++++++++++++++ templates/chrony.conf.cloudlinux.tmpl | 51 +++++++++++++++++++++
templates/chrony.conf.cloudlinux.tmpl | 51 ++++++++++++++++++++ templates/ntp.conf.almalinux.tmpl | 64 +++++++++++++++++++++++++++
templates/ntp.conf.almalinux.tmpl | 64 +++++++++++++++++++++++++ templates/ntp.conf.cloudlinux.tmpl | 64 +++++++++++++++++++++++++++
templates/ntp.conf.cloudlinux.tmpl | 64 +++++++++++++++++++++++++ 11 files changed, 253 insertions(+), 12 deletions(-)
12 files changed, 253 insertions(+), 18 deletions(-)
create mode 100644 templates/chrony.conf.almalinux.tmpl create mode 100644 templates/chrony.conf.almalinux.tmpl
create mode 100644 templates/chrony.conf.cloudlinux.tmpl create mode 100644 templates/chrony.conf.cloudlinux.tmpl
create mode 100644 templates/ntp.conf.almalinux.tmpl create mode 100644 templates/ntp.conf.almalinux.tmpl
@ -63,48 +53,19 @@ index 8d3fd9a..4dd5843 100644
"debian", "debian",
"fedora", "fedora",
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 9eef24f..1015d43 100644 index 9eef24f..653db7d 100644
--- a/cloudinit/config/cc_ntp.py --- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py +++ b/cloudinit/config/cc_ntp.py
@@ -109,14 +109,6 @@ DISTRO_CLIENT_CONFIG = { @@ -227,6 +227,9 @@ for distro in ("opensuse-microos", "opensuse-tumbleweed", "opensuse-leap"):
"service_name": "ntpd",
},
},
- "centos": {
- "ntp": {
- "service_name": "ntpd",
- },
- "chrony": {
- "service_name": "chronyd",
- },
- },
"cos": {
"chrony": {
"service_name": "chronyd",
@@ -224,6 +216,9 @@ DISTRO_CLIENT_CONFIG = {
for distro in ("opensuse-microos", "opensuse-tumbleweed", "opensuse-leap"):
DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["opensuse"]
+for distro in ("almalinux", "centos", "cloudlinux"):
+ DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["rhel"]
+
for distro in ("sle_hpc", "sle-micro"): for distro in ("sle_hpc", "sle-micro"):
DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["sles"] DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["sles"]
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py +for distro in ("almalinux", "cloudlinux", "rocky"):
index aa88919..4eb1d76 100644 + DISTRO_CLIENT_CONFIG[distro] = DISTRO_CLIENT_CONFIG["rhel"]
--- a/cloudinit/config/cc_resolv_conf.py +
+++ b/cloudinit/config/cc_resolv_conf.py # The schema definition for each cloud-config module is a strict contract for
@@ -57,7 +57,9 @@ meta: MetaSchema = { # describing supported configuration parameters for each cloud-config section.
"title": "Configure resolv.conf", # It allows cloud-config to validate and alert users to invalid or ignored
"description": MODULE_DESCRIPTION,
"distros": [
+ "almalinux",
"alpine",
+ "cloudlinux",
"fedora",
"mariner",
"opensuse",
diff --git a/cloudinit/settings.py b/cloudinit/settings.py diff --git a/cloudinit/settings.py b/cloudinit/settings.py
index 3a581e5..def6d4b 100644 index 3a581e5..def6d4b 100644
--- a/cloudinit/settings.py --- a/cloudinit/settings.py
@ -118,23 +79,32 @@ index 3a581e5..def6d4b 100644
"network": {"renderers": None}, "network": {"renderers": None},
}, },
"vendor_data": {"enabled": True, "prefix": []}, "vendor_data": {"enabled": True, "prefix": []},
diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py diff --git a/systemd/cloud-config.service.tmpl b/systemd/cloud-config.service.tmpl
index 9214f1b..14880ec 100644 index 76e50ae..047969a 100644
--- a/cloudinit/sources/DataSourceRbxCloud.py --- a/systemd/cloud-config.service.tmpl
+++ b/cloudinit/sources/DataSourceRbxCloud.py +++ b/systemd/cloud-config.service.tmpl
@@ -60,7 +60,7 @@ def _sub_arp(cmd): @@ -5,7 +5,7 @@ After=network-online.target cloud-config.target
After=snapd.seeded.service
def gratuitous_arp(items, distro): Before=systemd-user-sessions.service
source_param = "-S" Wants=network-online.target cloud-config.target
- if distro.name in ["fedora", "centos", "rhel"]: -{% if variant == "rhel" %}
+ if distro.name in ["almalinux", "fedora", "centos", "cloudlinux", "rhel"]: +{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
source_param = "-s" ConditionPathExists=!/etc/cloud/cloud-init.disabled
for item in items: ConditionKernelCommandLine=!cloud-init=disabled
try: {% endif %}
diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl
index 85f423a..4faef66 100644 index 85f423a..578c7f4 100644
--- a/systemd/cloud-final.service.tmpl --- a/systemd/cloud-final.service.tmpl
+++ b/systemd/cloud-final.service.tmpl +++ b/systemd/cloud-final.service.tmpl
@@ -7,7 +7,7 @@ After=multi-user.target
Before=apt-daily.service
{% endif %}
Wants=network-online.target cloud-config.service
-{% if variant == "rhel" %}
+{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final @@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
RemainAfterExit=yes RemainAfterExit=yes
TimeoutSec=0 TimeoutSec=0
@ -145,7 +115,7 @@ index 85f423a..4faef66 100644
ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \ ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
out=$(systemctl show --property=SubState $u) || exit; \ out=$(systemctl show --property=SubState $u) || exit; \
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
index 6f3f9d8..493eaf1 100644 index 6f3f9d8..3f56494 100644
--- a/systemd/cloud-init-local.service.tmpl --- a/systemd/cloud-init-local.service.tmpl
+++ b/systemd/cloud-init-local.service.tmpl +++ b/systemd/cloud-init-local.service.tmpl
@@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
@ -153,7 +123,7 @@ index 6f3f9d8..493eaf1 100644
[Unit] [Unit]
Description=Initial cloud-init job (pre-networking) Description=Initial cloud-init job (pre-networking)
-{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %} -{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %}
+{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel" ] %} +{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel"] %}
DefaultDependencies=no DefaultDependencies=no
{% endif %} {% endif %}
Wants=network-pre.target Wants=network-pre.target
@ -176,7 +146,15 @@ index 6f3f9d8..493eaf1 100644
Before=firewalld.target Before=firewalld.target
Conflicts=shutdown.target Conflicts=shutdown.target
{% endif %} {% endif %}
@@ -33,7 +33,7 @@ ConditionKernelCommandLine=!cloud-init=disabled @@ -26,14 +26,14 @@ Before=sysinit.target
Conflicts=shutdown.target
{% endif %}
RequiresMountsFor=/var/lib/cloud
-{% if variant == "rhel" %}
+{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
ConditionPathExists=!/etc/cloud/cloud-init.disabled
ConditionKernelCommandLine=!cloud-init=disabled
{% endif %}
[Service] [Service]
Type=oneshot Type=oneshot
@ -323,7 +301,7 @@ index 0000000..43b1f5d
+#log measurements statistics tracking +#log measurements statistics tracking
diff --git a/templates/ntp.conf.almalinux.tmpl b/templates/ntp.conf.almalinux.tmpl diff --git a/templates/ntp.conf.almalinux.tmpl b/templates/ntp.conf.almalinux.tmpl
new file mode 100644 new file mode 100644
index 0000000..9884df5 index 0000000..6d166aa
--- /dev/null --- /dev/null
+++ b/templates/ntp.conf.almalinux.tmpl +++ b/templates/ntp.conf.almalinux.tmpl
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
@ -342,7 +320,7 @@ index 0000000..9884df5
+# Permit all access over the loopback interface. This could +# Permit all access over the loopback interface. This could
+# be tightened as well, but to do so would effect some of +# be tightened as well, but to do so would effect some of
+# the administrative functions. +# the administrative functions.
+restrict 127.0.0.1 +restrict 127.0.0.1
+restrict -6 ::1 +restrict -6 ::1
+ +
+# Hosts on local network are less restricted. +# Hosts on local network are less restricted.
@ -377,7 +355,7 @@ index 0000000..9884df5
+includefile /etc/ntp/crypto/pw +includefile /etc/ntp/crypto/pw
+ +
+# Key file containing the keys and key identifiers used when operating +# Key file containing the keys and key identifiers used when operating
+# with symmetric key cryptography. +# with symmetric key cryptography.
+keys /etc/ntp/keys +keys /etc/ntp/keys
+ +
+# Specify the key identifiers which are trusted. +# Specify the key identifiers which are trusted.
@ -393,7 +371,7 @@ index 0000000..9884df5
+#statistics clockstats cryptostats loopstats peerstats +#statistics clockstats cryptostats loopstats peerstats
diff --git a/templates/ntp.conf.cloudlinux.tmpl b/templates/ntp.conf.cloudlinux.tmpl diff --git a/templates/ntp.conf.cloudlinux.tmpl b/templates/ntp.conf.cloudlinux.tmpl
new file mode 100644 new file mode 100644
index 0000000..9884df5 index 0000000..6d166aa
--- /dev/null --- /dev/null
+++ b/templates/ntp.conf.cloudlinux.tmpl +++ b/templates/ntp.conf.cloudlinux.tmpl
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
@ -412,7 +390,7 @@ index 0000000..9884df5
+# Permit all access over the loopback interface. This could +# Permit all access over the loopback interface. This could
+# be tightened as well, but to do so would effect some of +# be tightened as well, but to do so would effect some of
+# the administrative functions. +# the administrative functions.
+restrict 127.0.0.1 +restrict 127.0.0.1
+restrict -6 ::1 +restrict -6 ::1
+ +
+# Hosts on local network are less restricted. +# Hosts on local network are less restricted.
@ -447,7 +425,7 @@ index 0000000..9884df5
+includefile /etc/ntp/crypto/pw +includefile /etc/ntp/crypto/pw
+ +
+# Key file containing the keys and key identifiers used when operating +# Key file containing the keys and key identifiers used when operating
+# with symmetric key cryptography. +# with symmetric key cryptography.
+keys /etc/ntp/keys +keys /etc/ntp/keys
+ +
+# Specify the key identifiers which are trusted. +# Specify the key identifiers which are trusted.
@ -462,5 +440,5 @@ index 0000000..9884df5
+# Enable writing of statistics records. +# Enable writing of statistics records.
+#statistics clockstats cryptostats loopstats peerstats +#statistics clockstats cryptostats loopstats peerstats
-- --
2.43.5 2.48.1

View File

@ -59,7 +59,7 @@ Patch31: ci-fix-Clean-cache-if-no-datasource-fallback-5499.patch
Patch32: ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch Patch32: ci-fix-Add-subnet-ipv4-ipv6-to-network-schema-5191.patch
# AlmaLinux OS patches # AlmaLinux OS patches
Patch100: 0001-Improvements-for-AlmaLinux-OS-and-CloudLinux-OS.patch Patch100: 0001-fix-fix-and-improve-almalinux-and-cloudlinux-support.patch
BuildArch: noarch BuildArch: noarch
@ -275,7 +275,7 @@ fi
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
%changelog %changelog
* Thu Mar 13 2025 Andrew Lukoshko <alukoshko@almalinux.org> - 23.4-7.el8_10.8.alma.2 * Thu Mar 13 2025 Elkhan Mammadli <elkhan@almalinux.org> - 23.4-7.el8_10.8.alma.2
- Update AlmaLinux patch to fix issue with disabling cloud-init service [albz#500] - Update AlmaLinux patch to fix issue with disabling cloud-init service [albz#500]
* Tue Sep 24 2024 Eduard Abdullin <eabdullin@almalinux.org> - 23.4-7.el8_10.8.alma.1 * Tue Sep 24 2024 Eduard Abdullin <eabdullin@almalinux.org> - 23.4-7.el8_10.8.alma.1