From c6b22d7e13f3501282d275912e8d84ecaf687931 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 28 Aug 2018 14:28:48 -0700 Subject: [PATCH] unbound: fix dhclient.conf copy The original version of this was wishful thinking: "is file" only works locally, but this needs to run on the remote node. Change-Id: Ib683809fdf580f41d213308331925c4765bb09d9 --- playbooks/roles/unbound/tasks/dhclient.yaml | 11 +++++++++++ playbooks/roles/unbound/tasks/main.yaml | 8 ++------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 playbooks/roles/unbound/tasks/dhclient.yaml diff --git a/playbooks/roles/unbound/tasks/dhclient.yaml b/playbooks/roles/unbound/tasks/dhclient.yaml new file mode 100644 index 0000000000..ebb596b886 --- /dev/null +++ b/playbooks/roles/unbound/tasks/dhclient.yaml @@ -0,0 +1,11 @@ +- name: Register dhclient config file + stat: + path: "{{ item }}" + register: _dhclient + +- name: Write dhclient config file + when: _dhclient.stat.exists | bool + copy: + src: dhclient.conf + dest: "{{ item }}" + mode: 0444 diff --git a/playbooks/roles/unbound/tasks/main.yaml b/playbooks/roles/unbound/tasks/main.yaml index 36d8f345b6..1d6b708ce2 100644 --- a/playbooks/roles/unbound/tasks/main.yaml +++ b/playbooks/roles/unbound/tasks/main.yaml @@ -11,12 +11,8 @@ state: present name: unbound -- name: Write dhclient config file - copy: - src: dhclient.conf - dest: "{{ item }}" - mode: 0444 - when: item is file +- name: Write dhclient config files + include_tasks: dhclient.yaml loop: - /etc/dhcp/dhclient.conf - /etc/dhcp/dhclient-eth0.conf