Skip to content

cisco.ios.ios_l2_interfaces - wrong command for bpduguard #1285

@adparis99

Description

@adparis99

Bug Summary

When attempting to use ios_l2_interfaces to enable bpduguard, I get the following error message:

msg: "Unexpected failure during module execution: spanning-tree bpduguard enabled\r\nspanning-tree bpduguard enabled\r\n                              ^\r\n% Invalid input detected at '^' marker.\r\n\r\nSwitch-C9300(config-if)#"
exception: "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py\", line 165, in run\n    res = self._execute()\n  File \"/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py\", line 656, in _execute\n    result = self._handler.run(task_vars=vars_copy)\n  File \"/usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/action/ios.py\", line 50, in run\n    result = super(ActionModule, self).run(task_vars=task_vars)\n  File \"/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/action/network.py\", line 63, in run\n    result = self._exec_module(module)\n  File \"/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/action/network.py\", line 327, in _exec_module\n    module.main()  # allow unhandled module exceptions to fly; handled by TE to preserve as much error detail as possible\n  File \"/usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/modules/ios_l2_interfaces.py\", line 933, in main\n    result = L2_interfaces(module).execute_module()\n  File \"/usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/config/l2_interfaces/l2_interfaces.py\", line 90, in execute_module\n    self.run_commands()\n  File \"/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/rm_base/resource_module.py\", line 152, in run_commands\n    self._connection.edit_config(candidate=self.commands)\n  File \"/usr/local/lib/python3.9/site-packages/ansible/module_utils/connection.py\", line 200, in __rpc__\n    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\nansible.module_utils.connection.ConnectionError: spanning-tree bpduguard enabled\r\nspanning-tree bpduguard enabled\r\n                              ^\r\n% Invalid input detected at '^' marker.\r\n\r\nSwitch-C9300(config-if)#\n"
stdout: ''
_ansible_no_log: false

My task is as follows:

- name: Configure VLANs - Access & Voice
  ios_l2_interfaces:
    config:
      - name: "Gi1/0/1"
        mode: access
        access:
          vlan: "5"
        voice:
          vlan: "6"
        nonegotiate: true
        spanning_tree:
          bpduguard:             # I've tried with different variations of the disabled/enabled vars
            disabled: false
            enabled: true
          portfast:
            disabled: false
            trunk: false
    state: replaced

It appears to be attempting to use the command spanning-tree bpduguard enabled, which is invalid, instead of spanning-tree bpduguard enable. Looking through the code briefly, it might be caused by lines 228-230 of the parser templates file, but not really sure.

Select the relevant components

  • Module
  • Action Plugin
  • Connection Plugin (cliconf)
  • Terminal Plugin
  • Module Utils
  • Documentation
  • Integration Tests
  • Unit Tests
  • Collection Release
  • CI Maintenance
  • Workflow Maintenance

IOS Version

17.12.05

Hardware Platform

Catalyst

Module/Plugin Name

ios_l2_interfaces

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions