dhcpd: implement fixed-hosts capability
This commit is contained in:
parent
a2fef58a95
commit
d56dbc9412
|
@ -1,10 +1,10 @@
|
||||||
{%- import_yaml "netmasks.yaml" as netmasks -%}
|
{%- import_yaml "netmasks.yaml" as netmasks -%}
|
||||||
|
|
||||||
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
|
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
|
||||||
{%- if iface not in ['core', 'lo'] and pillar['subnets-inet'].get(iface) %}
|
{%- if iface not in ['core', 'lo'] and pillar['subnets-inet'].get(iface) %}
|
||||||
|
group {
|
||||||
{%- set conf = pillar['dhcp'][iface] %}
|
{%- set conf = pillar['dhcp'][iface] %}
|
||||||
{%- set subnet = pillar['subnets-inet'][iface] %}
|
{%- set subnet = pillar['subnets-inet'][iface] %}
|
||||||
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
||||||
authoritative;
|
authoritative;
|
||||||
default-lease-time {{ conf['time'] }};
|
default-lease-time {{ conf['time'] }};
|
||||||
max-lease-time {{ conf['max-time'] }};
|
max-lease-time {{ conf['max-time'] }};
|
||||||
|
@ -24,6 +24,12 @@ subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
||||||
{%- for name, value in (conf.get('string-opts') or {}).items() %}
|
{%- for name, value in (conf.get('string-opts') or {}).items() %}
|
||||||
option {{ name }} "{{ value }}";
|
option {{ name }} "{{ value }}";
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
}
|
||||||
|
|
||||||
|
{%- for addr, hwaddr in (conf.get('fixed-hosts') or {}).items() %}
|
||||||
|
host {{ addr }} { hardware ethernet {{ hwaddr }}; }
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
}
|
}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
Loading…
Reference in New Issue