From b10d707a8baa2530deb98a218c820762a2ce879a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Mon, 19 Apr 2021 13:02:48 -0400 Subject: [PATCH] nmcli: manual overwrite MAC address for any devices (#2224) * nmcli: manual overwrite MAC address for any devices Don't restrict the ability to manually set the MAC address to the bridge. NetworkManager is able to set a static MAC address to the vaste majority of the device types. * Update changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml | 3 +++ plugins/modules/net_tools/nmcli.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml diff --git a/changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml b/changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml new file mode 100644 index 0000000000..98852463d8 --- /dev/null +++ b/changelogs/fragments/2224_nmcli_allow_MAC_overwrite.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: +- "nmcli - don't restrict the ability to manually set the MAC address to the bridge (https://github.com/ansible-collections/community.general/pull/2224)." diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index 2b402a2230..4ae5a1dac9 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -210,7 +210,7 @@ options: default: 300 mac: description: - - This is only used with bridge - MAC address of the bridge. + - MAC address of the connection. - Note this requires a recent kernel feature, originally introduced in 3.15 upstream kernel. type: str slavepriority: @@ -742,7 +742,7 @@ class Nmcli(object): }) # Layer 2 options. - if self.mac_conn_type: + if self.mac: options.update({self.mac_setting: self.mac}) if self.mtu_conn_type: @@ -842,10 +842,6 @@ class Nmcli(object): 'wifi' ) - @property - def mac_conn_type(self): - return self.type == 'bridge' - @property def mac_setting(self): if self.type == 'bridge':