Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
cleanup duplicat code
Browse files Browse the repository at this point in the history
Signed-off-by: Furragen <git@axk.io>
  • Loading branch information
axkng committed Oct 5, 2019
1 parent b15fae1 commit c1d0f6b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 25 deletions.
27 changes: 2 additions & 25 deletions tasks/selinux.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
---
- name: install selinux dependencies when selinux is installed on RHEL or Oracle Linux 7
- name: install selinux dependencies when selinux is installed
package:
name: '{{ item }}'
name: '{{ ssh_selinux_packages }}'
state: present
with_items:
- 'policycoreutils-python'
- 'checkpolicy'
when:
- ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux'
- ansible_distribution_major_version <= "7"
- ansible_distribution != 'Fedora'

- name: install selinux dependencies when selinux is installed on RHEL or Oracle Linux 8
package:
name: '{{ item }}'
state: present
with_items:
- 'python3-policycoreutils'
- 'checkpolicy'
when:
- (ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux' and ansible_distribution_major_version >= "8") or ansible_distribution == 'Fedora'

- name: install selinux dependencies when selinux is installed on Debian or Ubuntu
apt:
name: ['policycoreutils', 'checkpolicy']
state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

- name: "authorize {{ ssh_server_ports }} ports for selinux"
seport:
Expand Down
3 changes: 3 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sshd_service_name: ssh
ssh_owner: root
ssh_group: root
ssh_selinux_packages:
- policycoreutils-python
- checkpolicy
6 changes: 6 additions & 0 deletions vars/Fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_selinux_packages:
- python3-policycoreutils
- checkpolicy
3 changes: 3 additions & 0 deletions vars/Oracle Linux.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_selinux_packages:
- policycoreutils-python
- checkpolicy
3 changes: 3 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_selinux_packages:
- policycoreutils-python
- checkpolicy
6 changes: 6 additions & 0 deletions vars/RedHat_8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_selinux_packages:
- python3-policycoreutils
- checkpolicy

0 comments on commit c1d0f6b

Please sign in to comment.