Refactor map/macro sourcing
All checks were successful
ci/lysergic/push/pipeline Pipeline was successful
All checks were successful
ci/lysergic/push/pipeline Pipeline was successful
- move pillar macros and map to base directory - move listener logic from macro to map - update includes respectively Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
096bb24769
commit
ba6522ce5b
@ -1,4 +1,4 @@
|
||||
{%- from slspath ~ '/map.jinja' import firewall_interfaces, public, internal, backend %}
|
||||
{%- from slspath ~ '/../map.jinja' import firewall_interfaces, public, internal, backend %}
|
||||
|
||||
include:
|
||||
- role.salt.common
|
||||
|
@ -1,4 +1,4 @@
|
||||
{%- from slspath ~ '/../global/macros.jinja' import listeners -%}
|
||||
{%- from slspath ~ '/../map.jinja' import listeners -%}
|
||||
{#-
|
||||
{%- from '/tmp/salt-libertacasa/pillar/global/macros.jinja' import listeners with context -%}
|
||||
#}
|
||||
|
@ -1,7 +1,29 @@
|
||||
{%- from slspath ~ '/macros.jinja' import firewall_interfaces -%}
|
||||
{%- from 'macros.jinja' import firewall_interfaces, listeners -%}
|
||||
{%- set firewall_interfaces = firewall_interfaces -%}
|
||||
{%- set listeners = listeners -%}
|
||||
{%- set minion = grains['id'] -%}
|
||||
|
||||
{#- START Listener detection logic -#}
|
||||
|
||||
{%- set listen_ips = [] -%}
|
||||
{%- set minion = grains['id'] -%}
|
||||
{%- set legal6s = ('fd29', '2a01:4f8:11e:2200') -%}
|
||||
{%- 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] -%}
|
||||
{%- if salt['network.is_private'](ip) -%}
|
||||
{%- do listen_ips.append(ip) -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}{%- endif -%}
|
||||
{%- if minion in ip6s -%}{%- for ip in ip6s[minion] -%}
|
||||
{%- if ip.startswith(legal6s) -%}
|
||||
{%- do listen_ips.append(ip) -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}{%- endif -%}
|
||||
|
||||
{#- END Listener detection logic -%}
|
||||
|
||||
|
||||
{#- START Interface mapping logic -#}
|
||||
|
||||
{%- set public = [] -%}
|
Loading…
Reference in New Issue
Block a user