diff --git a/partition/roles/dhcp/tasks/main.yaml b/partition/roles/dhcp/tasks/main.yaml index 52b26c80..44673dfd 100644 --- a/partition/roles/dhcp/tasks/main.yaml +++ b/partition/roles/dhcp/tasks/main.yaml @@ -17,11 +17,14 @@ loop_control: label: "{{ item.network }}" -- name: install isc-dhcp-server - apt: - name: - - isc-dhcp-server - update_cache : yes +- name: ensure config directories are present + file: + path: "{{ item }}" + state: directory + mode: 0755 + loop: + - /etc/dhcp + - /etc/default - name: render dhcpd conf template: @@ -42,11 +45,20 @@ when: dhcp_static_hosts is defined register: _hosts_conf +- name: install isc-dhcp-server + apt: + name: + - isc-dhcp-server + update_cache : yes + +# we want this task to be run at this point and not at the end of the playbook +# this is why we don't use a handler here - name: restart isc-dhcp-server on config change service: name: "{{ dhcp_service_name }}" enabled: true state: restarted + daemon-reload: true when: _dhcpd_conf is changed or _isc_dhcp_server is changed or _hosts_conf is changed - name: ensure isc-dhcp-server is running