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.

41 lines
1.0KB

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