# platform = multi_platform_all
# reboot = false
# strategy = configure
# complexity = low
# disruption = low
- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - DISA-STIG-UBTU-22-232140
  - configure_strategy
  - file_permissions_journalctl
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed

- name: Test for existence /usr/bin/journalctl
  ansible.builtin.stat:
    path: /usr/bin/journalctl
  register: file_exists
  when: '"linux-base" in ansible_facts.packages'
  tags:
  - DISA-STIG-UBTU-22-232140
  - configure_strategy
  - file_permissions_journalctl
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed

- name: Ensure permission u-s,g-xws,o-xwrt on /usr/bin/journalctl
  ansible.builtin.file:
    path: /usr/bin/journalctl
    mode: u-s,g-xws,o-xwrt
  when:
  - '"linux-base" in ansible_facts.packages'
  - file_exists.stat is defined and file_exists.stat.exists
  tags:
  - DISA-STIG-UBTU-22-232140
  - configure_strategy
  - file_permissions_journalctl
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed
