Add dhcp server role

This commit is contained in:
Markus 2017-03-27 17:42:48 +02:00
parent 40e6102c8c
commit 99c1451bdb
5 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
dhcp_interface: br-{{ site_code }}
dhcp_first: "{{ batman_ipv4 | ipaddr('512') | ipaddr('address') }}"
dhcp_last: "{{ batman_ipv4 | ipaddr('2558') | ipaddr('address') }}"
name_server: "{{ batman_ipv4 | ipaddr('address') }}"

View File

@ -0,0 +1,4 @@
---
- name: Restart isc-dhcp-server
service: name=isc-dhcp-server state=restarted

View File

@ -0,0 +1,11 @@
---
- name: Install dhcp server
apt: name=isc-dhcp-server state=latest
- name: Configure dhcp server
template: src=dhcpd.conf.j2 dest=/etc/dhcp/dhcpd.conf
notify: Restart isc-dhcp-server
- name: Start the dhcp server
service: name=isc-dhcp-server state=started enabled=yes

View File

@ -0,0 +1,28 @@
# dhcpd.conf
# option definitions common to all supported networks...
option domain-name "{{ site_domain }}";
option domain-name-servers {{ name_server }};
default-lease-time 3600;
max-lease-time 14400;
# Use this to enble / disable dynamic dns updates globally.
ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# Freifunk Regensburg
subnet {{ batman_ipv4 | ipaddr('network') }} netmask {{ batman_ipv4 | ipaddr('netmask') }} {
option routers {{ batman_ipv4 | ipaddr('address') }};
pool {
range {{ dhcp_first }} {{ dhcp_last }} ;
}
}

View File

@ -14,6 +14,7 @@
- fastd
- mesh-interfaces
- dns
- dhcpd
- name: Setup confluence server
hosts: confluence.regensburg.freifunk.net