add package handling for rh7 and rh8
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Robert Kaussow 2022-01-26 22:00:36 +01:00
parent f3018503a9
commit fbd630d3eb
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
7 changed files with 31 additions and 3 deletions

View File

@ -1,6 +1,6 @@
--- ---
selinux_packages: selinux_packages:
- policycoreutils-python - policycoreutils-python
selinux_policy: "targeted" selinux_policy: "targeted"
selinux_state: "{{ ansible_selinux.config_mode }}" selinux_state: "{{ ansible_selinux.config_mode }}"

View File

@ -9,4 +9,5 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_selinux_setup(host): def test_selinux_setup(host):
assert host.command.check_output("/usr/sbin/getenforce") == "Enforcing" assert host.command.check_output("/usr/sbin/getenforce") == "Enforcing"
assert host.package("libselinux-python").is_installed
assert host.package("policycoreutils-python").is_installed assert host.package("policycoreutils-python").is_installed

View File

@ -9,4 +9,5 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_selinux_setup(host): def test_selinux_setup(host):
assert host.command.check_output("/usr/sbin/getenforce") == "Enforcing" assert host.command.check_output("/usr/sbin/getenforce") == "Enforcing"
assert host.package("policycoreutils-python").is_installed assert host.package("libselinux-python").is_installed
assert host.package("policycoreutils-python-utils").is_installed

View File

@ -1,2 +1,15 @@
--- ---
- import_tasks: setup.yml - include_vars: "{{ var_files }}"
vars:
var_files: "{{ lookup('first_found', params, errors='ignore') }}"
params:
files:
- "{{ ansible_lsb.id | default('') | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family | lower }}.yml"
paths:
- "vars"
when: var_files
- include_tasks: overwrites.yml
- include_tasks: setup.yml

5
tasks/overwrites.yml Normal file
View File

@ -0,0 +1,5 @@
---
- name: Define selinux_packages
set_fact:
selinux_packages: "{{ __selinux_packages }}"
when: selinux_packages is not defined

4
vars/redhat-7.yml Normal file
View File

@ -0,0 +1,4 @@
---
__selinux_packages:
- libselinux-python
- policycoreutils-python

4
vars/redhat-8.yml Normal file
View File

@ -0,0 +1,4 @@
---
__selinux_packages:
- libselinux-python
- policycoreutils-python-utils