aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@labitat.dk>2018-10-02 17:42:08 +0200
committerEmil Renner Berthing <esmil@labitat.dk>2018-10-02 20:57:41 +0200
commit0531f80caf457831408367aaaedcc0446c00cdff (patch)
tree5bf967c20d47d6ae7a6923b0ee54e334f51402df
parent4b79196f128a32e2bf70b5d8e04274392760cc2c (diff)
downloadlabitat-ansible-0531f80caf457831408367aaaedcc0446c00cdff.tar.gz
labitat-ansible-0531f80caf457831408367aaaedcc0446c00cdff.tar.xz
labitat-ansible-0531f80caf457831408367aaaedcc0446c00cdff.zip
space_server: networkd: delete leftover configuration
-rw-r--r--roles/space_server/tasks/networkd.yml14
1 files changed, 14 insertions, 0 deletions
diff --git a/roles/space_server/tasks/networkd.yml b/roles/space_server/tasks/networkd.yml
index cab8cae..318fbb5 100644
--- a/roles/space_server/tasks/networkd.yml
+++ b/roles/space_server/tasks/networkd.yml
@@ -6,6 +6,12 @@
owner: root
group: root
mode: 0755
+
+- name: Register existing network configuration
+ find:
+ paths: '/etc/systemd/network'
+ register: networkd_existing
+
- name: Configure network
copy:
dest: '/etc/systemd/network/'
@@ -14,6 +20,14 @@
group: root
mode: 0644
with_fileglob: 'networkd/network/*'
+ register: networkd_created
+
+- name: Delete unneeded network configuration
+ file:
+ path: '{{ item }}'
+ state: absent
+ with_items: "{{ networkd_existing.files|map(attribute='path')|list }}"
+ when: "item not in networkd_created.results|map(attribute='dest')"
- name: Create systemd-networkd-wait-online drop-in directory
file: