Use ansible_service_mgr fact

This patch removes some extra tasks for detecting systemd and uses
the `ansible_service_mgr` fact instead.

Partial-Bug: #1640125
Change-Id: I240f2b09f123fb929eaca07fec72e981901d7a78
This commit is contained in:
Major Hayden 2016-11-09 22:07:42 -06:00 committed by Jesse Pretorius (odyssey4me)
parent a3e0f681d8
commit 235ee0604a
4 changed files with 8 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: