Changed delete logic
This commit is contained in:
parent
6acbb03400
commit
2b3fee1779
|
@ -19,24 +19,39 @@
|
||||||
state: absent
|
state: absent
|
||||||
tags: interfaces
|
tags: interfaces
|
||||||
|
|
||||||
- name: Get directory stats
|
# - name: Get directory stats
|
||||||
stat:
|
# stat:
|
||||||
path: "/etc/netplan"
|
# path: "/etc/netplan"
|
||||||
register: directory_stat
|
# 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:
|
file:
|
||||||
path: "/etc/netplan"
|
path: "{{ item.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
with_items: "{{ collected_files.files }}"
|
||||||
- name: Create directory
|
tags: interfaces
|
||||||
file:
|
|
||||||
path: "/etc/netplan"
|
|
||||||
state: directory
|
|
||||||
owner: "{{ directory_stat.stat.pw_name }}"
|
|
||||||
group: "{{ directory_stat.stat.gr_name }}"
|
|
||||||
mode: "{{ directory_stat.stat.mode }}"
|
|
||||||
|
|
||||||
- name: Add the bonding module
|
- name: Add the bonding module
|
||||||
modprobe:
|
modprobe:
|
||||||
name: bonding
|
name: bonding
|
||||||
|
|
Loading…
Reference in New Issue