15 lines
439 B
YAML
15 lines
439 B
YAML
- name: Check for existence of /var/lib/systemd/linger/{{ service_name }}
|
|
ansible.builtin.stat:
|
|
path: "/var/lib/systemd/linger/{{ service_name }}"
|
|
get_attributes: false
|
|
get_checksum: false
|
|
get_mime: false
|
|
follow: false
|
|
register: linger_stat
|
|
changed_when: false
|
|
|
|
- name: Enable linger for the user
|
|
ansible.builtin.command:
|
|
cmd: "loginctl enable-linger {{ service_name }}"
|
|
when: not linger_stat.stat.exists
|