Saltstack Official FirewallD Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # == State: firewalld.zones
  2. #
  3. # This state ensures that /etc/firewalld/zones/ exists.
  4. #
  5. {% from "firewalld/map.jinja" import firewalld with context %}
  6. directory_firewalld_zones:
  7. file.directory: # make sure this is a directory
  8. - name: /etc/firewalld/zones
  9. - user: root
  10. - group: root
  11. - mode: 750
  12. - require:
  13. - pkg: package_firewalld # make sure package is installed
  14. - listen_in:
  15. - module: service_firewalld # restart service
  16. # == Define: firewalld.zones
  17. #
  18. # This defines a zone configuration, see firewalld.zone (5) man page.
  19. #
  20. {% for k, v in salt['pillar.get']('firewalld:zones', {}).items() %}
  21. {% set z_name = v.name|default(k) %}
  22. /etc/firewalld/zones/{{ z_name }}.xml:
  23. file.managed:
  24. - name: /etc/firewalld/zones/{{ z_name }}.xml
  25. - user: root
  26. - group: root
  27. - mode: 644
  28. - source: salt://firewalld/files/zone.xml
  29. - template: jinja
  30. - require:
  31. - pkg: package_firewalld # make sure package is installed
  32. - file: directory_firewalld_zones
  33. - listen_in:
  34. - module: service_firewalld # restart service
  35. - context:
  36. name: {{ z_name }}
  37. zone: {{ v|json }}
  38. {% endfor %}