Files
Ansible-Bootstrap/roles/configuration/tasks/services.yml

23 lines
881 B
YAML

---
- name: Enable Systemd Services
ansible.builtin.command: >
{{ chroot_command }} /mnt systemctl enable NetworkManager
{{ ' firewalld' if firewalld_enabled | bool else '' }}
{{
' ssh' if os | lower in ['ubuntu', 'ubuntu-lts'] else
(' sshd' if os | lower not in ['debian11', 'debian12', 'debian13'] else '')
}}
{{
'logrotate systemd-resolved systemd-timesyncd systemd-networkd'
if os | lower == 'archlinux' else ''
}}
register: configuration_enable_services_result
changed_when: configuration_enable_services_result.rc == 0
- name: Disable firewalld when disabled
when: not firewalld_enabled | bool
ansible.builtin.command: "{{ chroot_command }} /mnt systemctl disable --now firewalld"
register: configuration_disable_firewalld_result
changed_when: configuration_disable_firewalld_result.rc == 0
failed_when: false