From 03bc8532ad167bff53e08b100a068573274a9d04 Mon Sep 17 00:00:00 2001 From: oxedions <oxedions@gmail.com> Date: Thu, 3 Apr 2025 15:49:56 +0200 Subject: [PATCH] Feat: Add infiniband mac address support in nmcli module --- plugins/modules/nmcli.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 3c895e76ec..67061b2d66 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -429,6 +429,10 @@ options: - MAC address of the connection. - Note this requires a recent kernel feature, originally introduced in 3.15 upstream kernel. type: str + infiniband_mac: + description: + - MAC address of the Infiniband IPoIB devices. + type: str slavepriority: description: - This is only used with 'bridge-slave' - [<0-63>] - STP priority of this slave. @@ -1737,6 +1741,7 @@ class Nmcli(object): self.hairpin = module.params['hairpin'] self.path_cost = module.params['path_cost'] self.mac = module.params['mac'] + self.infiniband_mac = module.params['infiniband_mac'] self.runner = module.params['runner'] self.runner_hwaddr_policy = module.params['runner_hwaddr_policy'] self.runner_fast_rate = module.params['runner_fast_rate'] @@ -2034,6 +2039,10 @@ class Nmcli(object): options.update({ 'infiniband.transport-mode': self.transport_mode, }) + if self.infiniband_mac: + options.update({ + 'infiniband.mac-address': self.infiniband_mac, + }) elif self.type == 'vrf': options.update({ 'table': self.table, @@ -2708,9 +2717,12 @@ def main(): tap=dict(type='bool'))), wireguard=dict(type='dict'), vpn=dict(type='dict'), - transport_mode=dict(type='str', choices=['datagram', 'connected']), sriov=dict(type='dict'), table=dict(type='int'), + # infiniband specific vars + transport_mode=dict(type='str', choices=['datagram', 'connected']), + infiniband_mac=dict(type='str'), + ), mutually_exclusive=[['never_default4', 'gw4'], ['routes4_extended', 'routes4'],