Saltstack Official FirewallD Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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