---
- name: Disable systemd ctrl-alt-del
  become: true
  ansible.builtin.systemd:
    name: ctrl-alt-del.target
    masked: true
    enabled: false
    state: stopped
  when: not ansible_os_family == "RedHat"
  tags:
    - ctrl-alt-del
    - CCE-80785-9
    - systemd

- name: Remove existing symlink for ctrl-alt-del.target if it exists
  become: true
  ansible.builtin.file:
    path: /etc/systemd/system/ctrl-alt-del.target
    state: absent
  when: ansible_os_family == "RedHat"
  tags:
    - ctrl-alt-del
    - CCE-80785-9
    - systemd

- name: Mask ctrl-alt-del.target to disable Ctrl+Alt+Del
  become: true
  ansible.builtin.systemd:
    name: ctrl-alt-del.target
    masked: true
    enabled: false
    state: stopped
  when: ansible_os_family == "RedHat"
  changed_when: false
  tags:
    - ctrl-alt-del
    - CCE-80785-9
    - systemd

