- position: {{ rule.position }} | - position: {{ rule.position }} | ||||
{%- else %} | {%- else %} | ||||
iptables.append: | iptables.append: | ||||
{%- if loop.index != 1 %} | |||||
- require: | - require: | ||||
{%- if loop.index != 1 %} | |||||
- iptables: iptables_{{ chain_name }}_{% if service_name is defined %}{{ service_name }}_{% endif %}{{ loop.index - 1 }} | - iptables: iptables_{{ chain_name }}_{% if service_name is defined %}{{ service_name }}_{% endif %}{{ loop.index - 1 }} | ||||
{%- else %} | |||||
{%- for chain in chains %} | |||||
- iptables: iptables_{{ chain }} | |||||
{%- endfor %} | |||||
{%- endif %} | {%- endif %} | ||||
{%- endif %} | {%- endif %} | ||||
- table: {{ rule.get('table', 'filter') }} | - table: {{ rule.get('table', 'filter') }} |
{% from "iptables/map.jinja" import service with context %} | {% from "iptables/map.jinja" import service with context %} | ||||
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %} | {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %} | ||||
{%- set chains = service.get('chain', {}).keys() %} | |||||
{%- for chain_name, chain in service.get('chain', {}).iteritems() %} | {%- for chain_name, chain in service.get('chain', {}).iteritems() %} | ||||
iptables_{{ chain_name }}: | iptables_{{ chain_name }}: |