Listeners macro: use mined addresses
Some checks failed
ci/lysergic/push/pipeline Pipeline failed

The network module run on the Salt master, but the macro should fetch
minion addresses.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-28 01:17:46 +01:00
parent 0ea6f8c62d
commit 08f23700c9
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -1,12 +1,13 @@
{%- macro listeners() -%} {%- macro listeners() -%}
{%- set listen_ips = [] -%} {%- set listen_ips = [] -%}
{%- set minion = grains['id'] -%}
{%- set legal6s = ('fd29', '2a01:4f8:11e:2200') -%} {%- set legal6s = ('fd29', '2a01:4f8:11e:2200') -%}
{%- for ip in salt['network.ip_addrs']() -%} {%- for ip in salt.saltutil.runner('mine.get', tgt=minion, fun='network.ip_addrs', tgt_type='glob')[minion] -%}
{%- if salt['network.is_private'](ip) -%} {%- if salt['network.is_private'](ip) -%}
{%- do listen_ips.append(ip) -%} {%- do listen_ips.append(ip) -%}
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
{%- for ip in salt['network.ip_addrs6']() -%} {%- for ip in salt.saltutil.runner('mine.get', tgt=minion, fun='network.ip_addrs6', tgt_type='glob')[minion] -%}
{%- if ip.startswith(legal6s) -%} {%- if ip.startswith(legal6s) -%}
{%- do listen_ips.append(ip) -%} {%- do listen_ips.append(ip) -%}
{%- endif -%} {%- endif -%}