From c8c6ce2a3893f2e8d0410de44a6e61f458f7616a Mon Sep 17 00:00:00 2001 From: Maciej Delmanowski Date: Tue, 7 Apr 2015 13:03:48 +0200 Subject: [PATCH] Make sure that included files exist before restart --- CHANGES.rst | 8 ++++++++ tasks/main.yml | 13 +++++++++++++ 2 files changed, 21 insertions(+) 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'