2016-11-09 00:23:58 +01:00
|
|
|
{%- import_yaml "netmasks.yaml" as netmasks -%}
|
|
|
|
|
|
|
|
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
|
|
|
|
{%- if iface not in ['core', 'lo'] %}
|
|
|
|
{%- set conf = pillar['dhcp'][iface] %}
|
|
|
|
{%- set subnet = pillar['subnets-inet'][iface] %}
|
|
|
|
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
|
|
|
authoritative;
|
|
|
|
default-lease-time {{ conf['time'] }};
|
|
|
|
max-lease-time {{ conf['max-time'] }};
|
|
|
|
range {{ conf['start'] }} {{ conf['end'] }};
|
|
|
|
{%- for name, value in conf['opts'].items() %}
|
|
|
|
option {{ name }} {{ value }};
|
|
|
|
{%- endfor %}
|
2016-11-16 01:17:28 +01:00
|
|
|
{%- for name, value in conf['host-opts'].items() %}
|
|
|
|
{%- set host = value.split('.')[0] %}
|
|
|
|
{%- set net = value.split('.')[1] %}
|
|
|
|
option {{ name }} {{ pillar['hosts-inet'][net][host] }};
|
|
|
|
{%- endfor %}
|
2016-11-14 23:44:13 +01:00
|
|
|
{%- for name, value in conf['string-opts'].items() %}
|
|
|
|
option {{ name }} "{{ value }}";
|
|
|
|
{%- endfor %}
|
2016-11-09 00:23:58 +01:00
|
|
|
}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|