forked from FF-RGB/ansible
Add dhcp server role
This commit is contained in:
parent
40e6102c8c
commit
99c1451bdb
6
roles/dhcpd/defaults/main.yml
Normal file
6
roles/dhcpd/defaults/main.yml
Normal 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') }}"
|
4
roles/dhcpd/handlers/main.yml
Normal file
4
roles/dhcpd/handlers/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart isc-dhcp-server
|
||||||
|
service: name=isc-dhcp-server state=restarted
|
11
roles/dhcpd/tasks/main.yml
Normal file
11
roles/dhcpd/tasks/main.yml
Normal 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
|
28
roles/dhcpd/templates/dhcpd.conf.j2
Normal file
28
roles/dhcpd/templates/dhcpd.conf.j2
Normal 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 }} ;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user