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.

46 lines
1.3KB

  1. # == State: firewalld.services
  2. #
  3. # This state ensures that /etc/firewalld/services/ exists.
  4. #
  5. {% from "firewalld/map.jinja" import firewalld with context %}
  6. directory_firewalld_services:
  7. file.directory: # make sure this is a directory
  8. - name: /etc/firewalld/services
  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.services
  17. #
  18. # This defines a service configuration, see firewalld.service (5) man page.
  19. # You usually don't need this, you can simply add ports to zone.
  20. {% for k, v in salt['pillar.get']('firewalld:services', {}).items() %}
  21. {% set s_name = v.name|default(k) %}
  22. /etc/firewalld/services/{{ s_name }}.xml:
  23. file:
  24. - managed
  25. - name: /etc/firewalld/services/{{ s_name }}.xml
  26. - user: root
  27. - group: root
  28. - mode: 644
  29. - source: salt://firewalld/files/service.xml
  30. - template: jinja
  31. - require:
  32. - pkg: package_firewalld # make sure package is installed
  33. - file: directory_firewalld_services
  34. - listen_in:
  35. - module: service_firewalld # restart service
  36. - context:
  37. name: {{ s_name }}
  38. service: {{ v|json }}
  39. {% endfor %}