|
@@ -1,11 +1,7 @@
|
|
|
#
|
|
|
# Gateway DHCP server configuration (Salt managed)
|
|
|
#
|
|
|
-{%- set sites = salt['pillar.get']('sites', {}) %}
|
|
|
-{%- set te = salt['pillar.get']('te', {}) %}
|
|
|
-{%- set node_config = salt['pillar.get']('nodes:' ~ grains['id']) %}
|
|
|
-{%- set te_prefixes = salt['ffho_net.get_te_prefixes'](te, grains['id'], 'v4') %}
|
|
|
-
|
|
|
+{%- set dhcp_prefixes = salt['pillar.get']("nodes:" ~ grains["id"] ~ ":dhcp:server:prefixes", []) %}
|
|
|
# The ddns-updates-style parameter controls whether or not the server will
|
|
|
# attempt to do a DNS update when a lease is confirmed. We default to the
|
|
|
# behavior of the version 2 packages ('none', since DHCP v2 didn't
|
|
@@ -19,27 +15,19 @@ max-lease-time 3600;
|
|
|
# Use Anycast DNS server(s)
|
|
|
option domain-name-servers 10.132.251.53;
|
|
|
|
|
|
-{% for site in node_config.get ('sites', [])|sort %}
|
|
|
- {%- set site_config = sites.get (site) %}
|
|
|
- {%- set site_prefix = site_config.get ('prefix_v4') %}
|
|
|
- {%- set brige_ips = salt['ffho_net.get_node_iface_ips'] (node_config, 'br-' ~ site) %}
|
|
|
-# {{ site }} / {{ site_config.get ('name') }}
|
|
|
-subnet {{ site_prefix.split ('/')[0] }} netmask {{ salt['ffho_net.cidr_to_dotted_mask'](site_prefix) }} {
|
|
|
+{% for prefix in dhcp_prefixes %}
|
|
|
+# {{ prefix["description"] }}
|
|
|
+subnet {{ prefix["network"] }} netmask {{ prefix["netmask"] }} {
|
|
|
pool {
|
|
|
- # monitor: 75% 90% Y {{ grains['nodename'] }}/{{ site }} DHCP pool
|
|
|
+ # monitor: 75% 90% Y {{ grains['nodename'] }}/{{ prefix["description"] }} DHCP pool
|
|
|
|
|
|
- # Use our own IP as gateway for our clients
|
|
|
- option routers {{ brige_ips['v4'][0] }};
|
|
|
+ option routers {{ prefix["routers"] }};
|
|
|
|
|
|
- # Range(s) of IPs to lease to clients
|
|
|
- {%- for prefix in te_prefixes|sort %}
|
|
|
- {%- if salt['ffho_net.is_subprefix'] (site_prefix, prefix) %}
|
|
|
- {%- set prefix_config = te_prefixes.get (prefix) %}
|
|
|
- {%- if 'dhcp_range' in prefix_config %}
|
|
|
- range {{ prefix_config.get ('dhcp_range') }};
|
|
|
- {%- endif %}
|
|
|
- {%- endif %}
|
|
|
- {%- endfor %}
|
|
|
+ {%- if "ranges" in prefix %}
|
|
|
+ {%- for range in prefix["ranges"] %}
|
|
|
+ range {{ range }};
|
|
|
+ {%- endfor %}
|
|
|
+ {%- endif %}
|
|
|
}
|
|
|
}
|
|
|
|