new service state handling

This commit is contained in:
2024-08-06 11:30:30 -04:00
parent 6fb410cffd
commit aba39cbad4
7 changed files with 108 additions and 55 deletions

View File

@ -0,0 +1,25 @@
---
- name: Check for Bigboot service state log presence
ansible.builtin.stat:
path: "{{ bigboot_disabled_services_log }}"
register: bigboot_disabled_services_log_stat
- name: Read state log and restore service state
when:
- bigboot_disabled_services_log_stat['stat']['exists'] | bool
block:
- name: Read service state from log
community.general.read_csv:
path: "{{ bigboot_disabled_services_log }}"
fieldnames: service,state,enabled
delimiter: ','
register: bigboot_service_state_contents
- name: Restore service state
ansible.builtin.service:
name: "{{ item['service'] }}"
state: "{{ item['state'] }}"
enabled: "{{ item['enabled'] | bool }}"
loop: "{{ bigboot_service_state_contents['list'] }}"
loop_control:
label: "{{ item['service'] }}"