2014-08-26 21:36:08 +00:00
|
|
|
---
|
|
|
|
|
2015-03-27 13:32:44 +00:00
|
|
|
- name: Configure DHCP relay in debconf
|
|
|
|
debconf:
|
|
|
|
name: 'isc-dhcp-relay'
|
|
|
|
question: 'isc-dhcp-relay/{{ item.key }}'
|
|
|
|
vtype: 'string'
|
|
|
|
value: '{{ item.value }}'
|
|
|
|
with_dict:
|
|
|
|
servers: '{{ dhcpd_relay_servers | join(" ") }}'
|
|
|
|
interfaces: '{{ dhcpd_relay_interfaces | join(" ") }}'
|
|
|
|
options: '{{ dhcpd_relay_options }}'
|
|
|
|
register: dhcpd_register_relay_debconf
|
|
|
|
when: dhcpd_mode == 'relay'
|
|
|
|
|
2015-03-27 09:50:21 +00:00
|
|
|
- name: Install DHCP packages
|
|
|
|
apt:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: 'present'
|
|
|
|
install_recommends: False
|
2015-03-27 13:32:44 +00:00
|
|
|
with_items: dhcpd_base_packages_map[dhcpd_mode]
|
|
|
|
|
|
|
|
- name: Reconfigure ISC DHCP relay
|
|
|
|
command: dpkg-reconfigure --frontend=noninteractive isc-dhcp-relay
|
|
|
|
notify: [ 'Restart isc-dhcp-relay' ]
|
|
|
|
when: dhcpd_register_relay_debconf|d() and dhcpd_register_relay_debconf.changed
|
2014-08-26 21:36:08 +00:00
|
|
|
|
|
|
|
- name: Configure DHCP server
|
2015-03-27 09:50:21 +00:00
|
|
|
template:
|
|
|
|
src: '{{ item }}.j2'
|
|
|
|
dest: '/{{ item }}'
|
|
|
|
owner: 'root'
|
|
|
|
group: 'root'
|
|
|
|
mode: '0644'
|
2014-08-26 21:36:08 +00:00
|
|
|
with_items: [ 'etc/default/isc-dhcp-server', 'etc/dhcp/dhcpd.conf' ]
|
2015-03-27 09:50:21 +00:00
|
|
|
notify: [ 'Restart isc-dhcp-server' ]
|
2015-03-27 13:32:44 +00:00
|
|
|
when: dhcpd_mode == 'server'
|
2014-08-26 21:36:08 +00:00
|
|
|
|
2015-03-29 19:13:24 +00:00
|
|
|
- name: Make sure that IPv6 lease file exists
|
|
|
|
command: touch /var/lib/dhcp/dhcpd6.leases creates=/var/lib/dhcp/dhcpd6.leases
|
|
|
|
when: dhcpd_ipversion == '6'
|
|
|
|
|