diff --git a/tasks/main.yml b/tasks/main.yml index 5cd8a0ba..5325c963 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,20 +24,6 @@ tags: - always - - name: Check init system - command: cat /proc/1/comm - register: _pid1_name - changed_when: False - check_mode: no - tags: - - always - - - name: Set the name of pid1 - set_fact: - pid1_name: "{{ _pid1_name.stdout }}" - tags: - - always - - name: Check for check/audit mode command: /bin/true register: noop_result @@ -48,7 +34,6 @@ - name: Set facts set_fact: check_mode: "{{ noop_result | skipped }}" - systemd_running: "{{ pid1_name == 'systemd' }}" linux_security_module: "{{ (ansible_os_family == 'Debian') | ternary('apparmor','selinux') }}" tags: - always diff --git a/tasks/rhel6stig/console.yml b/tasks/rhel6stig/console.yml index 51f366d3..3754a6c8 100644 --- a/tasks/rhel6stig/console.yml +++ b/tasks/rhel6stig/console.yml @@ -19,7 +19,8 @@ regexp: '^(#)?exec shutdown -r now "Control-Alt-Delete pressed"' line: '#exec shutdown -r now "Control-Alt-Delete pressed"' state: present - when: not systemd_running | bool + when: + - ansible_service_mgr != 'systemd' tags: - console - cat1 @@ -32,7 +33,8 @@ changed_when: False check_mode: no failed_when: False - when: systemd_running | bool + when: + - ansible_service_mgr == 'systemd' tags: - always - console @@ -42,7 +44,7 @@ - name: V-38668 - The x86 Ctrl-Alt-Delete key sequence must be disabled (systemd) command: systemctl mask ctrl-alt-del.target when: - - systemd_running | bool + - ansible_service_mgr == 'systemd' - "'masked' in cad_mask_check.stdout" tags: - console diff --git a/tasks/rhel6stig/misc.yml b/tasks/rhel6stig/misc.yml index fa792bca..2a362b72 100644 --- a/tasks/rhel6stig/misc.yml +++ b/tasks/rhel6stig/misc.yml @@ -292,7 +292,7 @@ line: "env DEFAULT_RUNLEVEL=2" when: - security_disable_x_windows | bool - - not systemd_running | bool + - ansible_service_mgr != 'systemd' tags: - cat2 - V-38674 @@ -303,7 +303,7 @@ changed_when: "'Created symlink' in systemctl_default_target.stdout" when: - security_disable_x_windows | bool - - systemd_running | bool + - ansible_service_mgr == 'systemd' tags: - cat2 - V-38674 diff --git a/tasks/rhel6stig/services.yml b/tasks/rhel6stig/services.yml index 822c28f5..55ca6f35 100644 --- a/tasks/rhel6stig/services.yml +++ b/tasks/rhel6stig/services.yml @@ -37,7 +37,7 @@ - name: Register which services are installed depending on platform set_fact: - services_installed: "{{ (systemd_running | bool) | ternary (systemd_services_installed, sysv_services_installed)}}" + services_installed: "{{ (ansible_service_mgr == 'systemd') | ternary (systemd_services_installed, sysv_services_installed)}}" - name: V-38437 - Automated file system mounting tools must be disabled service: