Refactor the services task to better handle systemd vs runit.

This commit is contained in:
2026-07-30 10:50:38 -07:00
parent faddea7492
commit b41a381385
+34 -17
View File
@@ -16,24 +16,13 @@
retries: 3
delay: 3
## CUPS ##
- name: General | Software | Services | CUPS | Disable
- name: General | Software | Services | CROND | Enable (runit)
service:
name: "{{ cups }}"
pattern: "{{ cups_pattern }}"
state: stopped
enabled: no
ignore_errors: yes
- name: General | Software | Services | CUPS-Browse | Disable
service:
name: "{{ cups_browse }}"
pattern: "{{ cups_browse_pattern }}"
state: stopped
enabled: no
ignore_errors: yes
name: "{{ crond }}"
state: started
enabled: yes
when: ansible_virtualization_type != 'docker'
and ansible_service_mgr == "runit"
## SSHD ##
@@ -95,6 +84,7 @@
- name: General | Software | Services | JournalCTL | Reduce Log Size
shell: journalctl --vacuum-size=100M
when: ansible_system == "Linux"
and ansible_service_mgr == "systemd"
ignore_errors: yes
@@ -131,3 +121,30 @@
# Add a field to general.yml config file which gets applied via timedatectl and /etc/localtime.
# Example of what to do to file:
# /etc/localtime -> ../usr/share/zoneinfo/America/Phoenix
## Disable ##
- name: General | Software | Services | Disable
service:
name: "{{ item.name }}"
pattern: "{{ item.pattern }}"
state: stopped
enabled: no
ignore_errors: yes
loop:
- {name: "{{ cups }}" , pattern: "{{ cups_pattern }}"}
- {name: "{{ cups_browse }}", pattern: "{{ cups_browse_pattern }}"}
when: ansible_service_mgr != "runit"
- name: General | Software | Services | Disable (runit)
service:
name: "{{ item.name }}"
state: stopped
enabled: no
ignore_errors: yes
loop:
- {name: "{{ cups }}" }
- {name: "{{ cups_browse }}"}
when: ansible_service_mgr = "runit"