attempting to disable ctrl-alt-del reboot always skips
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
Medium
|
Kevin Carter |
Bug Description
At the bottom is the code-snipit of the faulty code, it assumes the systemctl status returns 0 or 3, in which case I am experiencing it to return 3 all the time.
To fix I would simply just run the mask command without checking if it were mask'd to begin with.
Testing on my local RHEL7 (yum updated as of aug-09):
#### disabling the symlink
# systemctl unmask ctrl-alt-del.target
Removed symlink /etc/systemd/
#### check return code of status
# systemctl status ctrl-alt-
● reboot.target - Reboot
Loaded: loaded (/usr/lib/
Active: inactive (dead)
Docs: man:systemd.
3
#### enabling the symlink
# systemctl mask ctrl-alt-del.target
Created symlink from /etc/systemd/
#### check return code of status
systemctl status ctrl-alt-
● ctrl-alt-del.target
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
3
#### file: ansible-
#### line number: 38-58
# This returns an exit code of 0 if it's running, 3 if it's masked.
- name: Check if ctrl-alt-del.target is already masked
command: systemctl status ctrl-alt-del.target
register: cad_mask_check
check_mode: no
changed_when: False
failed_when: cad_mask_check.rc not in [0,3]
tags:
- always
- name: V-71993 - The x86 Ctrl-Alt-Delete key sequence must be disabled
command: systemctl mask ctrl-alt-del.target
when:
- security_
- cad_mask_check.rc != 3
notify:
- reload systemd
tags:
- high
- misc
- V-71993
tags: | added: low-hanging-fruit |
This should be fixed by using https:/ /docs.ansible. com/ansible/ 2.4/systemd_ module. html instead