# SPDX-License-Identifier: MIT
# Inputs:
#   __systemd_units_info
# Outputs:
#   ansible_facts
---
- name: Gather systemd units state for system and user units
  systemd_units:
    user: "{{ __systemd_units_info.key }}"
    user_facts: "{{ ansible_facts['systemd_units_user'] | d({}) }}"
  become: true
  become_user: "{{ __systemd_units_info.key }}"
  environment:
    XDG_RUNTIME_DIR: "{{ __systemd_units_info.value['xdg_dir'] }}"
