Saltstack Official IPTables Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637
  1. {% from "iptables/map.jinja" import service with context %}
  2. {%- for chain_name, chain in service.get('chain', {}).iteritems() %}
  3. {%- if chain.policy is defined %}
  4. iptables_{{ chain_name }}_policy:
  5. iptables.set_policy:
  6. - chain: {{ chain_name }}
  7. - policy: {{ chain.policy }}
  8. - table: filter
  9. {%- endif %}
  10. {%- for service_name, service in pillar.items() %}
  11. {%- if service.get('_support', {}).get('iptables', {}).get('enabled', False) %}
  12. {%- set grains_fragment_file = service_name+'/meta/iptables.yml' %}
  13. {%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
  14. {%- set grains_yaml = load_grains_file()|load_yaml %}
  15. {%- for rule in grains_yaml.iptables.rules %}
  16. {%- set rule_name = service_name+'_'+loop.index|string %}
  17. {% include "iptables/_rule.sls" %}
  18. {%- endfor %}
  19. {%- endif %}
  20. {%- endfor %}
  21. {%- for rule in chain.get('rules', []) %}
  22. {%- set rule_name = loop.index %}
  23. {% include "iptables/_rule.sls" %}
  24. {%- endfor %}
  25. {%- for rule_name, rule in chain.get('rule', {}).iteritems() %}
  26. {% include "iptables/_rule.sls" %}
  27. {%- endfor %}
  28. {%- endfor %}