Saltstack Official FirewallD 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.

62 lines
1.3KB

  1. # == State: firewalld
  2. #
  3. # This state installs/runs firewalld.
  4. #
  5. {% from "firewalld/map.jinja" import firewalld with context %}
  6. {% if salt['grains.get']('osfullname') == "SLES" and salt['grains.get']('osmajorrelease')|int < 15 %}
  7. firewalld-unsupported:
  8. test.show_notification:
  9. - text: |
  10. Firewalld is not supported on {{ grains['osfinger'] }}
  11. See https://www.suse.com/releasenotes/x86_64/SUSE-SLES/15/#fate-323460
  12. {% elif salt['pillar.get']('firewalld:enabled') %}
  13. include:
  14. - firewalld.config
  15. - firewalld.ipsets
  16. - firewalld.services
  17. - firewalld.zones
  18. - firewalld.direct
  19. # iptables service that comes with rhel/centos
  20. iptables:
  21. service.disabled:
  22. - enable: False
  23. ip6tables:
  24. service.disabled:
  25. - enable: False
  26. package_firewalld:
  27. pkg.installed:
  28. - name: {{ firewalld.package }}
  29. service_firewalld:
  30. service.running:
  31. - name: {{ firewalld.service }}
  32. - enable: True # start on boot
  33. - require:
  34. - pkg: package_firewalld
  35. - file: config_firewalld
  36. - service: iptables # ensure it's stopped
  37. - service: ip6tables # ensure it's stopped
  38. reload_firewalld:
  39. cmd.wait:
  40. - name: 'firewall-cmd --reload'
  41. - require:
  42. - service: service_firewalld
  43. {% else %}
  44. service_firewalld:
  45. service.dead:
  46. - name: {{ firewalld.service }}
  47. - enable: False # don't start on boot
  48. {% endif %}