dhcp on gw*

legacy
Astro 6 years ago
parent 44cd0886c9
commit 718eba8ab9

@ -0,0 +1,37 @@
dhcp:
serv:
start: 172.20.73.2
end: 172.20.73.63
time: 7776000
max-time: 31536000
opts:
domain-name: serv.zentralwerk.online
#domain-name-servers:
routers: 172.20.73.1
pub:
start: 172.20.76.2
end: 172.20.77.254
time: 300
max-time: 3600
opts:
domain-name: pub.zentralwerk.online
routers: 172.20.76.1
priv1:
start: 172.20.74.2
end: 172.20.74.14
time: 3600
max-time: 86400
opts:
domain-name: priv1.zentralwerk.online
routers: 172.20.74.1
priv2:
start: 172.20.75.2
end: 172.20.75.14
time: 3600
max-time: 86400
opts:
domain-name: priv2.zentralwerk.online
routers: 172.20.75.1

@ -3,3 +3,5 @@ base:
- hosts
- subnets
- vlans
'*gw':
- dhcp

@ -0,0 +1,17 @@
{%- 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 %}
}
{%- endif %}
{%- endfor %}

@ -0,0 +1,7 @@
isc-dhcp-server:
pkg.installed: []
/etc/dhcp/dhcpd.conf:
file.managed:
- source: salt://dhcp/dhcpd.conf
- template: 'jinja'

@ -8,6 +8,7 @@ base:
- no-ssh
- forwarding
- ospf
- dhcp
'upstream*':
- no-ssh
- forwarding

Loading…
Cancel
Save