manage_netplan/tasks/remove_existing.yml

18 lines
484 B
YAML
Raw Normal View History

2023-04-11 21:32:34 +00:00
---
# task/remove_existing file for manage_netplan
- name: "Capturing existing configurations"
ansible.builtin.find:
paths: /etc/netplan
patterns: "*.yml,*.yaml"
register: _netplan_configs
become: true
2023-04-11 21:32:34 +00:00
- name: "Removing existing configurations"
ansible.builtin.file:
path: "{{ item['path'] }}"
state: absent
loop: "{{ _netplan_configs['files'] }}"
when: item['path'] != manage_netplan_config_file
and manage_netplan_configuration != []
become: true