Saltstack Official FirewallD Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

42 lines
1.1KB

  1. # == State: firewalld._service
  2. #
  3. # This state ensures that /etc/firewalld/services/ exists.
  4. #
  5. /etc/firewalld/services:
  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._service
  15. #
  16. # This defines a service configuration, see firewalld.service (5) man page.
  17. # You usually don't need this, you can simply add ports to zone.
  18. {% for k, v in salt['pillar.get']('firewalld:services', {}).items() %}
  19. {% set s_name = v.name|default(k) %}
  20. /etc/firewalld/services/{{ s_name }}.xml:
  21. file:
  22. - managed
  23. - name: /etc/firewalld/services/{{ s_name }}.xml
  24. - user: root
  25. - group: root
  26. - mode: 644
  27. - source: salt://firewalld/files/service.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: {{ s_name }}
  35. service: {{ v }}
  36. {% endfor %}