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.

_service.sls 1.1KB

10 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041
  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 %}