ansible-ffibk/roles/service-dhcpd/tasks/main.yml
2017-10-26 22:35:55 +02:00

34 lines
894 B
YAML

---
- name: install dhcp packages
package:
name: isc-dhcp-server
state: present
- name: concatenate meshbridge interfaces
set_fact:
dhcp_interfaces: "{% for mesh in meshes %}{{ mesh.id }}BR{% if not loop.last %} {% endif %}{% endfor %}"
- 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
notify: restart isc dhcp server
- name: enable systemd unit isc-dhcp-server
systemd:
name: isc-dhcp-server
enabled: yes
state: started