dhcpd: implement fixed-hosts capability

This commit is contained in:
Astro 2020-11-17 12:48:09 +01:00
parent a2fef58a95
commit d56dbc9412
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{%- import_yaml "netmasks.yaml" as netmasks -%}
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
{%- if iface not in ['core', 'lo'] and pillar['subnets-inet'].get(iface) %}
group {
{%- set conf = pillar['dhcp'][iface] %}
{%- set subnet = pillar['subnets-inet'][iface] %}
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
@ -25,5 +25,11 @@ subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
option {{ name }} "{{ value }}";
{%- endfor %}
}
{%- for addr, hwaddr in (conf.get('fixed-hosts') or {}).items() %}
host {{ addr }} { hardware ethernet {{ hwaddr }}; }
{%- endfor %}
}
{%- endif %}
{%- endfor %}