2017-09-05 12:01:27 +02:00
|
|
|
---
|
|
|
|
- name: install dhcp packages
|
|
|
|
apt:
|
|
|
|
name: isc-dhcp-server
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: enable systemd unit isc-dhcp-server
|
|
|
|
systemd:
|
|
|
|
name: isc-dhcp-server
|
|
|
|
enabled: yes
|
|
|
|
daemon_reload: yes
|
|
|
|
|
|
|
|
- name: concatenate meshbridge interfaces
|
|
|
|
set_fact:
|
2017-10-03 20:52:02 +02:00
|
|
|
dhcp_interfaces: "{% for mesh_id, mesh_value in meshes.iteritems() %}{{ mesh_id }}BR{% if not loop.last %} {% endif %}{% endfor %}"
|
2017-09-05 12:01:27 +02:00
|
|
|
|
|
|
|
- name: set ipv4 interfaces isc dhcp should listen on
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/default/isc-dhcp-server
|
|
|
|
regexp: '^INTERFACESv4="'
|
|
|
|
line: 'INTERFACESv4="{{ dhcp_interfaces }}"'
|
|
|
|
notify: restart isc dhcp server
|
|
|
|
|
|
|
|
- name: set ipv6 interfaces isc dhcp should listen on
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/default/isc-dhcp-server
|
|
|
|
regexp: '^INTERFACESv6="'
|
|
|
|
line: 'INTERFACESv6=""'
|
|
|
|
|
|
|
|
- name: configure isc dhcp server
|
|
|
|
template:
|
|
|
|
src: dhcpd.conf.j2
|
|
|
|
dest: /etc/dhcp/dhcpd.conf
|
2017-10-03 14:44:38 +02:00
|
|
|
notify: restart isc dhcp server
|