refactor(configuration): add platform_config dict and replace is_rhel/is_debian with os_family lookups

This commit is contained in:
2026-02-22 02:26:54 +01:00
parent cc30637f09
commit 3deb3ea751
11 changed files with 101 additions and 44 deletions

View File

@@ -1,13 +1,13 @@
---
- name: Enable systemd services
when: os not in ['alpine', 'void']
when: _configuration_platform.init_system == 'systemd'
vars:
configuration_systemd_services: >-
{{
['NetworkManager']
+ (['firewalld'] if system_cfg.features.firewall.backend == 'firewalld' and system_cfg.features.firewall.enabled | bool else [])
+ (['ufw'] if system_cfg.features.firewall.backend == 'ufw' and system_cfg.features.firewall.enabled | bool else [])
+ ([('ssh' if is_debian | bool else 'sshd')] if system_cfg.features.ssh.enabled | bool else [])
+ ([_configuration_platform.ssh_service] if system_cfg.features.ssh.enabled | bool else [])
+ (['logrotate', 'systemd-timesyncd'] if os == 'archlinux' else [])
}}
ansible.builtin.command: "{{ chroot_command }} systemctl enable {{ item }}"
@@ -16,7 +16,7 @@
changed_when: configuration_enable_service_result.rc == 0
- name: Enable OpenRC services
when: os == 'alpine'
when: _configuration_platform.init_system == 'openrc'
vars:
configuration_openrc_services: >-
{{
@@ -48,7 +48,7 @@
when: item.stat.exists
- name: Enable runit services
when: os == 'void'
when: _configuration_platform.init_system == 'runit'
vars:
configuration_runit_services: >-
{{