Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is fix for #182 - Dependency problem in linux/system/selinux.sls. #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions linux/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
'package': {},
'autoupdates': {
'pkgs': []
},
'selinux': 'permissive',
},
'selinux': {
'pkgs': [],
'mode': 'permissive',
},
'ca_certs_dir': '/usr/local/share/ca-certificates',
'ca_certs_bin': 'update-ca-certificates',
'atop': {
Expand All @@ -25,7 +28,7 @@
'autostart': true,
'logpath': '/var/log/atop',
'outfile': '/var/log/atop/daily.log'
},
},
'at': {
'pkgs': [],
'services': []
Expand All @@ -52,7 +55,10 @@
'autoupdates': {
'pkgs': ['unattended-upgrades']
},
'selinux': 'permissive',
'selinux': {
'pkgs': [],
'mode': 'permissive',
},
'ca_certs_dir': '/usr/local/share/ca-certificates',
'ca_certs_bin': 'update-ca-certificates',
'atop': {
Expand All @@ -74,7 +80,7 @@
},
},
'RedHat': {
'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
'pkgs': ['telnet', 'wget'],
'utc': true,
'user': {},
'group': {},
Expand All @@ -90,7 +96,10 @@
'autoupdates': {
'pkgs': []
},
'selinux': 'permissive',
'selinux': {
'pkgs': ['policycoreutils','policycoreutils-python'],
'mode': 'permissive',
},
'ca_certs_dir': '/etc/pki/ca-trust/source/anchors',
'ca_certs_bin': 'update-ca-trust extract',
'atop': {
Expand Down Expand Up @@ -381,6 +390,7 @@ Debian:
'pkgs': [],
'service': 'multipath'
},
'lvm_pkgs': ['lvm2'],
},
}, merge=salt['grains.filter_by']({
'trusty': {
Expand Down
25 changes: 18 additions & 7 deletions linux/system/selinux.sls
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.selinux is defined %}
{%- if grains.os_family == 'RedHat' %}

include:
- linux.system.repo
{% if system.selinux is mapping %}

{%- if grains.os_family == 'RedHat' %}
{%- set mode = system.selinux %}
{% if system.selinux.pkgs %}
linux_system_selinux_pkgs:
pkg.installed:
- pkgs: {{ system.selinux.pkgs }}
{%- endif %}

{{ mode }}:
{%- if system.selinux.mode %}
{{ system.selinux.mode }}:
selinux.mode:
- require:
- pkg: linux_repo_prereq_pkgs
- pkg: linux_system_selinux_pkgs
{%- endif %}

{%- endif %}
{%- else %}

{{ system.selinux }}:
selinux.mode

{%- endif %}

{%- endif %}
{%- endif %}

3 changes: 2 additions & 1 deletion tests/pillar/system.sls
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ linux:
domain: ci.local
environment: prd
purge_repos: true
selinux: permissive
selinux:
mode: permissive
directory:
/tmp/test:
makedirs: true
Expand Down