Skip to content

Commit

Permalink
feat(systemd): Improve AlmaLinux OS and CloudLinux OS support (#5265)
Browse files Browse the repository at this point in the history
AlmaLinux OS is binary compatible with RHEL
and CloudLinux OS based on AlmaLinux OS.

Use the same options with rhel on these systemd services:
- Cloud-init: Local Stage (pre-network): cloud-init-local.service
- Cloud-init: Network Stage: cloud-init.service
- Cloud-init: Final Stage: cloud-final.service

Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
  • Loading branch information
LKHN authored May 9, 2024
1 parent 9388cc1 commit dce1d4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion systemd/cloud-final.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final
RemainAfterExit=yes
TimeoutSec=0
KillMode=process
{% if variant == "rhel" %}
{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
# Restart NetworkManager if it is present and running.
ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \
out=$(systemctl show --property=SubState $u) || exit; \
Expand Down
10 changes: 5 additions & 5 deletions systemd/cloud-init-local.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
[Unit]
# https://cloudinit.readthedocs.io/en/latest/explanation/boot.html
Description=Cloud-init: Local Stage (pre-network)
{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %}
{% if variant in ["almalinux", "cloudlinux", "ubuntu", "unknown", "debian", "rhel"] %}
DefaultDependencies=no
{% endif %}
Wants=network-pre.target
After=hv_kvp_daemon.service
After=systemd-remount-fs.service
{% if variant == "rhel" %}
{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
Requires=dbus.socket
After=dbus.socket
{% endif %}
Before=NetworkManager.service
{% if variant == "rhel" %}
{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
Before=network.service
{% endif %}
Before=network-pre.target
Before=shutdown.target
{% if variant == "rhel" %}
{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
Before=firewalld.target
Conflicts=shutdown.target
{% endif %}
Expand All @@ -33,7 +33,7 @@ ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled

[Service]
Type=oneshot
{% if variant == "rhel" %}
{% if variant in ["almalinux", "cloudlinux", "rhel"] %}
ExecStartPre=/bin/mkdir -p /run/cloud-init
ExecStartPre=/sbin/restorecon /run/cloud-init
ExecStartPre=/usr/bin/touch /run/cloud-init/enabled
Expand Down
2 changes: 1 addition & 1 deletion systemd/cloud-init.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[Unit]
# https://cloudinit.readthedocs.io/en/latest/explanation/boot.html
Description=Cloud-init: Network Stage
{% if variant not in ["photon", "rhel"] %}
{% if variant not in ["almalinux", "cloudlinux", "photon", "rhel"] %}
DefaultDependencies=no
{% endif %}
Wants=cloud-init-local.service
Expand Down

0 comments on commit dce1d4c

Please sign in to comment.