ansible/roles/firewall/templates/ipset.v4.j2

18 lines
632 B
Plaintext
Raw Normal View History

2019-08-30 02:34:58 +00:00
{% macro render_ipset(ipset, name, type="hash:net", family="inet", timeout=None) %}
create {{ name }} {{ type | default('hash:net') }} family {{ family }} counters {% if timeout %}timeout {{ timeout }}{% endif %} -exist
2019-08-25 02:06:19 +00:00
flush {{ name }}
2019-11-29 04:47:59 +00:00
{% if ipset | length %}
{% for ip_or_net in ipset | ipv4 %}
2019-08-25 02:06:19 +00:00
add {{ name }} {{ ip_or_net }}
{% endfor %}
2019-11-29 04:47:59 +00:00
{% endif %}
2019-08-25 02:06:19 +00:00
{% endmacro %}
2019-11-29 04:47:59 +00:00
{{ render_ipset(firewall_ipset_mgmt, 'mgmt_v4') }}
2019-08-25 02:06:19 +00:00
2019-11-29 04:47:59 +00:00
{{ render_ipset(firewall_ipset_blacklist, 'blacklist_v4') }}
2019-08-25 02:06:19 +00:00
2019-11-29 04:47:59 +00:00
{{ render_ipset(firewall_ipset_bogons, 'bogons_v4') }}
2019-08-30 02:34:58 +00:00
2019-09-02 17:54:36 +00:00
{{ render_ipset([], 'cooloff_v4', type="hash:ip", timeout=firewall_ipset_cooloff_timeout) }}