Saltstack Official FirewallD Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

43 lines
1.2KB

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