diff options
author | Georg Pfuetzenreuter | 2023-01-28 01:17:46 +0100 |
---|---|---|
committer | Georg Pfuetzenreuter | 2023-01-28 01:32:23 +0100 |
commit | 08f23700c94f446c2194a3d0b2b2b2858bc4680c (patch) | |
tree | 8c464d8151de339f54479c4aa8e4a35829cb31a9 | |
parent | 0ea6f8c62de40ef08fa65e311a8d64c2f9b9005d (diff) | |
download | salt-08f23700c94f446c2194a3d0b2b2b2858bc4680c.tar.gz salt-08f23700c94f446c2194a3d0b2b2b2858bc4680c.tar.bz2 salt-08f23700c94f446c2194a3d0b2b2b2858bc4680c.zip |
Listeners macro: use mined addresses
The network module run on the Salt master, but the macro should fetch
minion addresses.
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
-rw-r--r-- | pillar/global/macros.jinja | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pillar/global/macros.jinja b/pillar/global/macros.jinja index 3cc8848..90e73e2 100644 --- a/pillar/global/macros.jinja +++ b/pillar/global/macros.jinja @@ -1,12 +1,13 @@ {%- macro listeners() -%} {%- set listen_ips = [] -%} +{%- set minion = grains['id'] -%} {%- 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) -%} {%- do listen_ips.append(ip) -%} {%- endif -%} {%- 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) -%} {%- do listen_ips.append(ip) -%} {%- endif -%} |