Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

selinux.sls 795B

1234567891011121314151617181920212223242526272829303132333435363738
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.selinux is defined %}
  3. {%- if system.enabled %}
  4. include:
  5. - linux.system.repo
  6. {%- if grains.os_family == 'RedHat' %}
  7. {%- set mode = system.selinux %}
  8. {%- if system.selinux == 'disabled' %}
  9. selinux_config:
  10. cmd.run:
  11. - names:
  12. - "sed -i 's/enforcing/disabled/g' /etc/selinux/config"
  13. - "sed -i 's/permissive/disabled/g' /etc/selinux/config"
  14. - unless: cat '/etc/selinux/config' | grep 'SELINUX=disabled'
  15. selinux_setenforce:
  16. cmd.run:
  17. - name: "setenforce 0"
  18. - unless: getenforce | grep 'Disabled'
  19. {%- else %}
  20. selinux_config:
  21. selinux.mode:
  22. - name: {{ system.get('selinux', 'permissive') }}
  23. - require:
  24. - pkg: linux_repo_prereq_pkgs
  25. {%- endif %}
  26. {%- endif %}
  27. {%- endif %}
  28. {%- endif %}