2023-01-26 23:05:21 +01:00
|
|
|
{%- macro listeners() -%}
|
|
|
|
{%- set listen_ips = [] -%}
|
2023-01-28 01:17:46 +01:00
|
|
|
{%- set minion = grains['id'] -%}
|
2023-01-26 23:05:21 +01:00
|
|
|
{%- set legal6s = ('fd29', '2a01:4f8:11e:2200') -%}
|
2023-01-28 01:52:07 +01:00
|
|
|
{%- set ip4s = salt.saltutil.runner('mine.get', tgt=minion, fun='network.ip_addrs', tgt_type='glob') -%}
|
|
|
|
{%- set ip6s = salt.saltutil.runner('mine.get', tgt=minion, fun='network.ip_addrs6', tgt_type='glob') -%}
|
|
|
|
{%- if minion in ip4s -%}{%- for ip in ip4s[minion] -%}
|
2023-01-26 23:05:21 +01:00
|
|
|
{%- if salt['network.is_private'](ip) -%}
|
|
|
|
{%- do listen_ips.append(ip) -%}
|
|
|
|
{%- endif -%}
|
2023-01-28 01:52:07 +01:00
|
|
|
{%- endfor -%}{%- endif -%}
|
|
|
|
{%- if minion in ip6s -%}{%- for ip in ip6s[minion] -%}
|
2023-01-26 23:05:21 +01:00
|
|
|
{%- if ip.startswith(legal6s) -%}
|
|
|
|
{%- do listen_ips.append(ip) -%}
|
|
|
|
{%- endif -%}
|
2023-01-28 01:52:07 +01:00
|
|
|
{%- endfor -%}{%- endif -%}
|
2023-01-26 23:05:21 +01:00
|
|
|
{%- for ip in listen_ips %}
|
|
|
|
- {{ ip }}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endmacro -%}
|
2023-01-29 17:27:58 +01:00
|
|
|
|
|
|
|
{%- macro firewall_interfaces(interfaces) -%}
|
|
|
|
{%- if interfaces | length -%}
|
|
|
|
interfaces: {{ interfaces }}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endmacro -%}
|