Skip to content
Snippets Groups Projects
Commit 2d6cf866 authored by MyIgel's avatar MyIgel :fire:
Browse files

Keep stuff sorted

parent 64f3eb81
No related branches found
No related tags found
1 merge request!592Keep stuff sorted
Pipeline #33862 passed
......@@ -10,15 +10,15 @@ def mac(domain_id, host_id):
def all_instances():
tmp = []
all = []
for domain in __salt__['pillar.get']('domains'):
domain_id = __salt__['pillar.get'](
'domains:{}:domain_id'.format(domain))
instances = __salt__['pillar.get'](
'domains:{0}:fastd:instances'.format(domain), [])
tmp.extend(["dom{0}_{1}".format(domain_id, instance['mtu'])
all.extend(["dom{0}_{1}".format(domain_id, instance['mtu'])
for instance in instances])
return tmp
return all
# enumerate fastd interface names for mesh-announce
......
protocol direct d_domains {
interface {% for domain in pillar['domains'].values() -%} "dom{{ domain['domain_id'] }}-br"{% if not loop.last %}, {% endif %}{% endfor %};
interface {% for domain in pillar['domains'].values()|sort(attribute='domain_id') -%} "dom{{ domain['domain_id'] }}-br"{% if not loop.last %}, {% endif %}{% endfor %};
}
......@@ -6,7 +6,7 @@ protocol radv radv_dom{{ domain_id }} {
min delay {{ salt['pillar.get']('radv:min_delay', 3) }};
max ra interval 60;
other config yes;
{%- for prefix,prefixval in pillar['domains'][domain]['IPv6']['subnets'].items() %}
{%- for prefix,prefixval in pillar['domains'][domain]['IPv6']['subnets'].items()|sort %}
prefix {{ prefix }} {
{%- if not ('announce' in prefixval and prefixval['announce'] == False ) %}
valid lifetime 3600;
......@@ -17,12 +17,12 @@ protocol radv radv_dom{{ domain_id }} {
};
{%- endfor %}
rdnss {
{%- for ns in pillar['domains'][domain]['IPv6']['name_servers'] %}
{%- for ns in pillar['domains'][domain]['IPv6']['name_servers']|sort %}
ns {{ ns }};
{%- endfor %}
};
dnssl {
{%- for domain in salt['pillar.get']('domains:%s:search'|format(domain)) %}
{%- for domain in salt['pillar.get']('domains:%s:search'|format(domain))|sort %}
domain "{{ domain }}";
{%- endfor %}
};
......
......@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
ExecStart=/usr/local/go/bin/fastd-exporter -instances {{ ','.join(salt['fastd.all_instances']()) }} --metrics.perpeer
ExecStart=/usr/local/go/bin/fastd-exporter -instances {{ ','.join(salt['fastd.all_instances']()|sort) }} --metrics.perpeer
[Install]
WantedBy=multi-user.target
......@@ -2,7 +2,7 @@
"Dhcp6":
{
"interfaces-config": {
"interfaces": {{ salt['kea.v6_interfaces']()|json }}
"interfaces": {{ salt['kea.v6_interfaces']()|sort|json }}
},
"lease-database": {
"type": "memfile",
......
......@@ -5,7 +5,7 @@
domain (ip ip6) {
table filter {
chain FORWARD {
interface dom{{ domain_id }}-br saddr ({{ " ".join(nets4|list + nets6|list) }}) {
interface dom{{ domain_id }}-br saddr ({{ " ".join(nets4|sort + nets6|sort) }}) {
proto tcp dport smtp REJECT;
ACCEPT;
}
......@@ -13,7 +13,7 @@ domain (ip ip6) {
}
table nat {
chain POSTROUTING {
outerface {{ salt['pillar.get']('ferm:public_interface', 'ens13') }} saddr ({{ ' '.join(nets4) }}) SNAT to {{ routing['internet']['addr4'] }};
outerface {{ salt['pillar.get']('ferm:public_interface', 'ens13') }} saddr ({{ ' '.join(nets4|sort) }}) SNAT to {{ routing['internet']['addr4'] }};
}
}
}
......
......@@ -10,7 +10,7 @@ domain ip6 {
table filter {
chain INPUT {
saddr ({%- for ip in vtep.values() %}
saddr ({%- for ip in vtep.values()|sort %}
{{ ip }}
{%- endfor %}) proto udp dport 4789 ACCEPT;
}
......
......@@ -81,7 +81,7 @@
ip link set master dom{{ domain_id }}-bat dev dom{{ domain_id }}-tp
ip link set mtu {{ salt['pillar.get']('domains:%s:mtu'|format(domain), 1312) }} dev dom{{ domain_id }}-tp
{% endif %}
{%- for vtepIP in vtep.values() %}
{%- for vtepIP in vtep.values()|sort %}
bridge fdb append 00:00:00:00:00:00 dev dom{{ domain_id }}-tp dst {{ vtepIP }}
{%- endfor %}
{% endif %}
......
domain (ip6) {
table filter {
chain INPUT {
interface ({%- for domain in salt['pillar.get']('domains', {}).values() %}dom{{ domain['domain_id'] }}-br{% if not loop.last %} {% endif %}{%- endfor %}) {
interface ({%- for domain in salt['pillar.get']('domains', {}).values()|sort(attribute='domain_id') %}dom{{ domain['domain_id'] }}-br{% if not loop.last %} {% endif %}{%- endfor %}) {
saddr fe80::/64 proto udp dport 10001 ACCEPT;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment