blob: 95ec4b0647778ef7a300c0ef2585366b92ce44fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
---
- name: Make sure /etc/systemd/network exists
file:
dest: '/etc/systemd/network'
state: directory
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/'
src: '{{ item }}'
owner: root
group: root
mode: 0644
with_fileglob: 'networkd/*'
loop_control:
label: '/etc/systemd/network/{{ item|basename }}'
register: networkd_created
- name: Delete unneeded network configuration
file:
path: '/etc/systemd/network/{{ item }}'
state: absent
with_items: "{{ networkd_existing.files|map(attribute='path')|map('basename')|difference(networkd_created.results|map(attribute='item')|map('basename'))|list }}"
# vim: set ts=2 sw=2 et:
|