ansible-ffibk/roles/service-dhcpd/tasks/main.yml
Tobias Hachmer 94cb21daad Add a bunch of new roles
- Update Readme
- Update ansible.cfg
- Add playbook to set up gateways
- Add group variables
2017-09-11 23:21:44 +02:00

39 lines
984 B
YAML

---
- name: install dhcp packages
apt:
name: isc-dhcp-server
state: present
become: true
- name: enable systemd unit isc-dhcp-server
systemd:
name: isc-dhcp-server
enabled: yes
daemon_reload: yes
become: true
- name: concatenate meshbridge interfaces
set_fact:
dhcp_interfaces: "{% for key, value in meshes.iteritems() %}{{ key }}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
become: true
- name: set ipv6 interfaces isc dhcp should listen on
lineinfile:
path: /etc/default/isc-dhcp-server
regexp: '^INTERFACESv6="'
line: 'INTERFACESv6=""'
become: true
- name: configure isc dhcp server
template:
src: dhcpd.conf.j2
dest: /etc/dhcp/dhcpd.conf
# notify: restart isc dhcp server
become: true