Changed delete logic
This commit is contained in:
parent
6acbb03400
commit
2b3fee1779
|
@ -19,23 +19,38 @@
|
|||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Get directory stats
|
||||
stat:
|
||||
path: "/etc/netplan"
|
||||
register: directory_stat
|
||||
# - name: Get directory stats
|
||||
# stat:
|
||||
# path: "/etc/netplan"
|
||||
# register: directory_stat
|
||||
|
||||
- name: Delete directory
|
||||
# - name: Delete directory
|
||||
# file:
|
||||
# path: "/etc/netplan"
|
||||
# state: absent
|
||||
|
||||
# - name: Create directory
|
||||
# file:
|
||||
# path: "/etc/netplan"
|
||||
# state: directory
|
||||
# owner: "{{ directory_stat.stat.pw_name }}"
|
||||
# group: "{{ directory_stat.stat.gr_name }}"
|
||||
# mode: "{{ directory_stat.stat.mode }}"
|
||||
- name: 'Collect files in netplan dir'
|
||||
find:
|
||||
paths: "/etc/netplan/"
|
||||
hidden: True
|
||||
recurse: True
|
||||
# file_type: any # Added in ansible 2.3
|
||||
register: collected_files
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove collected files
|
||||
file:
|
||||
path: "/etc/netplan"
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
|
||||
- name: Create directory
|
||||
file:
|
||||
path: "/etc/netplan"
|
||||
state: directory
|
||||
owner: "{{ directory_stat.stat.pw_name }}"
|
||||
group: "{{ directory_stat.stat.gr_name }}"
|
||||
mode: "{{ directory_stat.stat.mode }}"
|
||||
with_items: "{{ collected_files.files }}"
|
||||
tags: interfaces
|
||||
|
||||
- name: Add the bonding module
|
||||
modprobe:
|
||||
|
|
Loading…
Reference in New Issue