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:
parent
a3e0f681d8
commit
235ee0604a
@ -24,20 +24,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- 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
|
- name: Check for check/audit mode
|
||||||
command: /bin/true
|
command: /bin/true
|
||||||
register: noop_result
|
register: noop_result
|
||||||
@ -48,7 +34,6 @@
|
|||||||
- name: Set facts
|
- name: Set facts
|
||||||
set_fact:
|
set_fact:
|
||||||
check_mode: "{{ noop_result | skipped }}"
|
check_mode: "{{ noop_result | skipped }}"
|
||||||
systemd_running: "{{ pid1_name == 'systemd' }}"
|
|
||||||
linux_security_module: "{{ (ansible_os_family == 'Debian') | ternary('apparmor','selinux') }}"
|
linux_security_module: "{{ (ansible_os_family == 'Debian') | ternary('apparmor','selinux') }}"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
regexp: '^(#)?exec shutdown -r now "Control-Alt-Delete pressed"'
|
regexp: '^(#)?exec shutdown -r now "Control-Alt-Delete pressed"'
|
||||||
line: '#exec shutdown -r now "Control-Alt-Delete pressed"'
|
line: '#exec shutdown -r now "Control-Alt-Delete pressed"'
|
||||||
state: present
|
state: present
|
||||||
when: not systemd_running | bool
|
when:
|
||||||
|
- ansible_service_mgr != 'systemd'
|
||||||
tags:
|
tags:
|
||||||
- console
|
- console
|
||||||
- cat1
|
- cat1
|
||||||
@ -32,7 +33,8 @@
|
|||||||
changed_when: False
|
changed_when: False
|
||||||
check_mode: no
|
check_mode: no
|
||||||
failed_when: False
|
failed_when: False
|
||||||
when: systemd_running | bool
|
when:
|
||||||
|
- ansible_service_mgr == 'systemd'
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
- console
|
- console
|
||||||
@ -42,7 +44,7 @@
|
|||||||
- name: V-38668 - The x86 Ctrl-Alt-Delete key sequence must be disabled (systemd)
|
- name: V-38668 - The x86 Ctrl-Alt-Delete key sequence must be disabled (systemd)
|
||||||
command: systemctl mask ctrl-alt-del.target
|
command: systemctl mask ctrl-alt-del.target
|
||||||
when:
|
when:
|
||||||
- systemd_running | bool
|
- ansible_service_mgr == 'systemd'
|
||||||
- "'masked' in cad_mask_check.stdout"
|
- "'masked' in cad_mask_check.stdout"
|
||||||
tags:
|
tags:
|
||||||
- console
|
- console
|
||||||
|
@ -292,7 +292,7 @@
|
|||||||
line: "env DEFAULT_RUNLEVEL=2"
|
line: "env DEFAULT_RUNLEVEL=2"
|
||||||
when:
|
when:
|
||||||
- security_disable_x_windows | bool
|
- security_disable_x_windows | bool
|
||||||
- not systemd_running | bool
|
- ansible_service_mgr != 'systemd'
|
||||||
tags:
|
tags:
|
||||||
- cat2
|
- cat2
|
||||||
- V-38674
|
- V-38674
|
||||||
@ -303,7 +303,7 @@
|
|||||||
changed_when: "'Created symlink' in systemctl_default_target.stdout"
|
changed_when: "'Created symlink' in systemctl_default_target.stdout"
|
||||||
when:
|
when:
|
||||||
- security_disable_x_windows | bool
|
- security_disable_x_windows | bool
|
||||||
- systemd_running | bool
|
- ansible_service_mgr == 'systemd'
|
||||||
tags:
|
tags:
|
||||||
- cat2
|
- cat2
|
||||||
- V-38674
|
- V-38674
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
- name: Register which services are installed depending on platform
|
- name: Register which services are installed depending on platform
|
||||||
set_fact:
|
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
|
- name: V-38437 - Automated file system mounting tools must be disabled
|
||||||
service:
|
service:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user