shrink_lv/tasks/restore_services.yml
Chris Hammer 4bea43d589 Sync with Develop (#7)
Reviewed-on: #7
Co-authored-by: Chris Hammer <chris@thezengarden.net>
Co-committed-by: Chris Hammer <chris@thezengarden.net>
2025-01-08 16:44:31 -05:00

26 lines
854 B
YAML

---
- 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'] }}"