dhcp on gw*

This commit is contained in:
Astro 2016-11-09 00:23:58 +01:00
parent 44cd0886c9
commit 718eba8ab9
5 changed files with 64 additions and 0 deletions

37
salt-pillar/dhcp/init.sls Normal file
View File

@ -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

View File

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

17
salt/dhcp/dhcpd.conf Normal file
View File

@ -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 %}

7
salt/dhcp/init.sls Normal file
View File

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

View File

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