2018-11-15 22:42:58 +00:00
|
|
|
---
|
2019-10-19 13:34:22 +00:00
|
|
|
- name: Set current selinux policy
|
|
|
|
set_fact:
|
2019-10-19 13:37:38 +00:00
|
|
|
selinux_current: "{{ ansible_selinux.config_mode }}"
|
2019-10-19 13:34:22 +00:00
|
|
|
|
2018-11-15 22:42:58 +00:00
|
|
|
- block:
|
2019-10-19 13:34:22 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop: "{{ selinux_packages }}"
|
|
|
|
|
2018-11-15 22:42:58 +00:00
|
|
|
- name: Set selinux policy
|
|
|
|
selinux:
|
|
|
|
policy: "{{ selinux_policy }}"
|
|
|
|
state: "{{ selinux_state }}"
|
|
|
|
register: __sestatus
|
|
|
|
|
|
|
|
- name: Add .autorelabel file (requires a reboot)
|
|
|
|
file:
|
|
|
|
path: /.autorelabel
|
|
|
|
state: touch
|
|
|
|
when:
|
|
|
|
- selinux_state == "enforcing"
|
2019-10-19 13:34:22 +00:00
|
|
|
- selinux_current == "disabled"
|
2018-11-15 22:42:58 +00:00
|
|
|
- __sestatus.changed
|
|
|
|
become: True
|
|
|
|
become_user: root
|