dhcp: fix templating
This commit is contained in:
parent
f2725528cf
commit
ceec7bf5db
|
@ -1,6 +1,6 @@
|
|||
{%- set ifaces = [] %}
|
||||
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
|
||||
{%- if iface not in ['core', 'lo'] %}
|
||||
{%- if iface not in ['core', 'lo'] and pillar['subnets-inet'].get(iface) %}
|
||||
{%- set ifaces = ifaces.append(iface) %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
|
|
@ -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'] %}
|
||||
{%- if iface not in ['core', 'lo'] and pillar['subnets-inet'].get(iface) %}
|
||||
{%- set conf = pillar['dhcp'][iface] %}
|
||||
{%- set subnet = pillar['subnets-inet'][iface] %}
|
||||
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
||||
|
@ -9,15 +9,15 @@ subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
|
|||
default-lease-time {{ conf['time'] }};
|
||||
max-lease-time {{ conf['max-time'] }};
|
||||
range {{ conf['start'] }} {{ conf['end'] }};
|
||||
{%- for name, value in conf['opts'].items() %}
|
||||
{%- for name, value in (conf.get('opts') or {}).items() %}
|
||||
option {{ name }} {{ value }};
|
||||
{%- endfor %}
|
||||
{%- for name, value in conf['host-opts'].items() %}
|
||||
{%- for name, value in (conf.get('host-opts') or {}).items() %}
|
||||
{%- set host = value.split('.')[0] %}
|
||||
{%- set net = value.split('.')[1] %}
|
||||
option {{ name }} {{ pillar['hosts-inet'][net][host] }};
|
||||
{%- endfor %}
|
||||
{%- for name, value in conf['string-opts'].items() %}
|
||||
{%- for name, value in (conf.get('string-opts') or {}).items() %}
|
||||
option {{ name }} "{{ value }}";
|
||||
{%- endfor %}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue