# platform = multi_platform_all
# reboot = false
# strategy = disable
# complexity = low
# disruption = low

# Currently, Ansible can only collect systemd facts about service units. Socket units are needed.
- name: "Disable systemd-journal-remote Socket - Collect systemd Socket Units Present in the System"
  ansible.builtin.command:
    cmd: systemctl -q list-unit-files --type socket
  register: result_systemd_unit_files
  changed_when: false
  check_mode: false

- name: "Disable systemd-journal-remote Socket - Ensure systemd-journal-remote.socket is Masked"
  ansible.builtin.systemd:
    name: systemd-journal-remote.socket
    state: stopped
    enabled: false
    masked: true
  when:
    - result_systemd_unit_files.stdout_lines is search("systemd-journal-remote.socket")