diff --git a/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml b/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml new file mode 100644 index 0000000000..130800b6da --- /dev/null +++ b/changelogs/fragments/3216-nmcli-bridge-idempotency-fix.yml @@ -0,0 +1,2 @@ +bugfixes: + - nmcli - fixed idempotency issue for bridge connections. Module forced default value of ``bridge.priority`` to nmcli if not set; if ``bridge.stp`` is disabled nmcli ignores it and keep default (https://github.com/ansible-collections/community.general/issues/3216, https://github.com/ansible-collections/community.general/issues/4683). diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 0a9eff8da1..d967ddd446 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -1629,6 +1629,10 @@ class Nmcli(object): 'bridge.priority': self.priority, 'bridge.stp': self.stp, }) + # priority make sense when stp enabed, otherwise nmcli keeps bridge-priority to 32768 regrdless of input. + # force ignoring to save idempotency + if self.stp: + options.update({'bridge.priority': self.priority}) elif self.type == 'team': options.update({ 'team.runner': self.runner,