---
- name: converge resource-control slice unit files
  ansible.builtin.copy:
    src: "{{ playbook_dir }}/../modules/monitor/systemd/user/{{ item }}"
    dest: "{{ ansible_env.HOME }}/.config/systemd/user/{{ item }}"
    mode: "0644"
  loop: "{{ systemd_slice_units }}"
  register: systemd_units_result

- name: reload systemd user daemon if any slice changed (apply mode only)
  ansible.builtin.systemd:
    scope: user
    daemon_reload: true
  when: not ansible_check_mode and systemd_units_result.changed
