diff --git a/CHANGES.rst b/CHANGES.rst index 10ef2af..dfd639c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,14 @@ Changelog ========= +v0.1.1 +------ + +*Unreleased* + +- Make sure that files specified in ``dhcpd_includes`` list exist before the + DHCP server is restarted. [drybjed] + v0.1.0 ------ diff --git a/tasks/main.yml b/tasks/main.yml index 2381fc3..8555fe8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -47,8 +47,21 @@ mode: '0644' with_items: [ 'etc/default/isc-dhcp-server', 'etc/dhcp/dhcpd.conf' ] notify: [ 'Restart isc-dhcp-server' ] + register: dhcpd_register_config when: dhcpd_mode == 'server' +- name: Make sure that included files exist + file: + path: '{{ item }}' + state: 'touch' + owner: 'root' + group: 'root' + mode: '0644' + with_items: dhcpd_includes + notify: [ 'Restart isc-dhcp-server' ] + when: ((item is defined and item) and dhcpd_mode == 'server' and + (dhcpd_register_config is defined and dhcpd_register_config.changed)) + - 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'