25 lines
754 B
YAML
25 lines
754 B
YAML
# SPDX-License-Identifier: BSD-3-Clause
|
|
---
|
|
- set_fact: lsr_net_profile_exists=false
|
|
|
|
- name: stat profile file
|
|
stat:
|
|
get_attributes: false
|
|
get_checksum: false
|
|
get_mime: false
|
|
path: /etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
|
register: profile_stat
|
|
|
|
- set_fact: lsr_net_profile_exists=true
|
|
when: profile_stat.stat.exists
|
|
|
|
# When certain profile is marked as absent but still up, the `nmcli connection`
|
|
# still show it with FILENAME starting with /run. Only consider profile exists
|
|
# when its FILENAME is in /etc folder
|
|
- shell: nmcli -f NAME,FILENAME connection show |grep {{ profile }} | grep /etc
|
|
register: nm_profile_exists
|
|
ignore_errors: yes
|
|
|
|
- set_fact: lsr_net_profile_exists=true
|
|
when: nm_profile_exists.rc == 0
|