9ba91813fc
Removing the ens3 network-scripts file is needed when creating a Centos 8 VM for the undercloud in baremetal deployments. Change-Id: I28760c662b7aaf27582c46281855d79f874f369e
22 lines
479 B
YAML
22 lines
479 B
YAML
---
|
|
- name: Discover if ens3 interface exists
|
|
become: true
|
|
setup:
|
|
gather_subset: network
|
|
register: net
|
|
|
|
- name: Check if ifcfg-ens3 exists
|
|
become: true
|
|
stat:
|
|
path: /etc/sysconfig/network-scripts/ifcfg-ens3
|
|
register: ens3_interface
|
|
|
|
- name: Remove the interface file
|
|
become: true
|
|
file:
|
|
path: /etc/sysconfig/network-scripts/ifcfg-ens3
|
|
state: absent
|
|
when:
|
|
- ens3_interface.stat.exists
|
|
- "'ens3' not in net.ansible_facts.ansible_interfaces"
|