Reviewed-on: #7 Co-authored-by: Chris Hammer <chris@thezengarden.net> Co-committed-by: Chris Hammer <chris@thezengarden.net>
26 lines
854 B
YAML
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'] }}"
|