Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion tests/playbooks/tests_mac_address_match.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# after the parent interface, following the standard `<parent>.<vlan_id>` format.
# - `vlan_profile2` (e.g., `120-vlan`) has a fixed name, designed to test a scenario
# where lexicographic sorting causes the VLAN to appear before its parent interface.
interface: "{{ lookup('env', 'MAC_ADDR_MATCH_INTERFACE') | default('eth1', true) }}"
default_interface: "{{ lookup('env', 'MAC_ADDR_MATCH_INTERFACE') | default('eth1', true) }}"
profile: "{{ interface }}"
vlan_profile1: "{{ interface }}.3732"
vlan_profile2: "120-vlan"
Expand All @@ -39,6 +39,24 @@
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"

- name: Find interface to use
shell:
executable: /bin/bash
cmd: |
set -euxo pipefail
for iface in '{{ default_interface }}' ens4; do
if ip addr show "$iface" 1>&2; then
break
fi
done
echo "$iface"
changed_when: false
register: __network_interface_cmd

- name: Set interface to use
set_fact:
interface: "{{ __network_interface_cmd.stdout | trim }}"

- name: Retrieve MAC address using ethtool
command: ethtool -P {{ interface }}
register: mac_address_result
Expand Down
Loading