Good morning everyone, I am trying to make the following configurations that would be done manually on a Cisco Nexus switch:
interface Eth1/<INTERFACE-ID-DOWNLINK>
description <HDNUMBER>
switchport
switchport mode trunk
switchport trunk allowed vlan <VLAN-ID>
mtu 9216
no shutdown
exit
I found the cisco.nxos.nxos_interface
module and I was able to define the following functions:
- cisco.nxos.nxos_interfaces:
config:
- name: "{{porta}}"
description: "{{hdnumber}}"
mtu: 9216
enabled: true
However, when I tried to use the nxos.nxos_config
to set the switchport as trunk, I got the following error:
- cisco.nxos.nxos_config:
lines:
- interface {{porta}} # Define the interface (replace {{porta}} with the interface name, e.g., Ethernet1/1)
- switchport mode trunk # Set the interface as trunk
- switchport trunk allowed vlan 10,20 # Set the allowed VLANs on the trunk
- switchport trunk native vlan 1 # Set the native VLAN
ERROR:
TASK [cisco.nxos.nxos_config] ******************************************************************
fatal: [cloudstorage_primary]: FAILED! => {"changed": false, "msg": "switchport mode trunk\r\r\n ^\r\n% Invalid command at '^' marker.\r\n\rTESTE-SPEEDbUMPS(config)# "}
Could someone help me?