Closed xXAzazelXx closed 3 months ago
Does not look like NDFC exposes duplex
as a property but you can set it using the cmds
option from the module.
Something like this:
- name: Create Access Port using variables
cisco.dcnm.dcnm_interface:
fabric: "{{ fabric_name }}"
state: merged
config:
- name: '{{ item.Interface }}'
type: eth
switch:
- '{{ item.Hostname }}'
deploy: false
profile:
admin_state: true
mode: access
access_vlan: '{{ item.VLAN }}'
bpdu_guard: '{{ item.BPDU_Guard }}'
description: '{{ item.Description }}'
mtu: jumbo
port_type_fast: true
speed: '{{ item.Speed }}'
cmds:
- duplex full
Thank you, So the reason I suspected I needed duplex specified was that after editing the template to add duplex as a enum var for the user to select, I started getting this error:
*
failed: [XXXX_NDFC_IP] (item={'Hostname': 'XXXX_HOSTNAME', 'Interface': 'Eth1/30', 'Description': 'XXXXX', 'Speed': '100Mb', 'VLAN': '1', 'BPDU_Guard': 'true'}) => {"ansible_loop_var": "item", "changed": false, "item": {"BPDU_Guard": "true", "Description": "XXXXX", "Hostname": "XXXX_HOSTNAME", "Interface": "Eth1/30", "Speed": "100Mb", "VLAN": "1"}, "msg": {"CHANGED": [{"debugs": [], "deleted": [], "deploy": [], "merged": [{"interfaceType": "INTERFACE_ETHERNET", "interfaces": [{"ifName": "Ethernet1/30", "nvPairs": {"CONF": "duplex auto", "SPEED": "100Mb"}}]}], "overridden": [], "query": [], "replaced": []}], "DATA": [{"column": 0, "entity": "XXXX_HOSTNAME:Ethernet1/30", "line": 0, "message": "Traceback (most recent call last):\n File \"<string>\", line 74, in add\n File \"<string>\", line 74, in add\nNameError: global name 'DUPLEX' is not defined\n", "reportItemType": "ERROR"}], "MESSAGE": "Internal Server Error", "METHOD": "PUT", "REQUEST_PATH": "https://XXXX_NDFC_IP:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface", "RETURN_CODE": 500}}
However, i am still getting the same issue with cmds.
failed: [XXXX_NDFC_IP] (item={'Hostname': 'XXXX_HOSTNAME', 'Interface': 'Eth1/30', 'Description': 'XXXXX', 'Speed': '100Mb', 'VLAN': '1', 'BPDU_Guard': 'true'}) => {"ansible_loop_var": "item", "changed": false, "item": {"BPDU_Guard": "true", "Description": "XXXXX", "Hostname": "XXXX_HOSTNAME", "Interface": "Eth1/30", "Speed": "100Mb", "VLAN": "1"}, "msg": {"CHANGED": [{"debugs": [], "deleted": [], "deploy": [], "merged": [{"interfaceType": "INTERFACE_ETHERNET", "interfaces": [{"ifName": "Ethernet1/30", "nvPairs": {"CONF": "duplex auto", "SPEED": "100Mb"}}]}], "overridden": [], "query": [], "replaced": []}], "DATA": [{"column": 0, "entity": "XXXX_HOSTNAME:Ethernet1/30", "line": 0, "message": "Traceback (most recent call last):\n File \"<string>\", line 74, in add\n File \"<string>\", line 74, in add\nNameError: global name 'DUPLEX' is not defined\n", "reportItemType": "ERROR"}], "MESSAGE": "Internal Server Error", "METHOD": "PUT", "REQUEST_PATH": "https://XXXX_NDFC_IP:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface", "RETURN_CODE": 500}}
Are you still working with the edited template? If so, can you go back to the original template?
Yes, I was. Sorry, are you suggesting removing the new duplex settings from the interface template and just using cmds to hard code? the issue will be if a person were to update the interface description for example, NDFC will try to remove the duplex setting as the template knows nothing about it.
Yes, I was. Sorry, are you suggesting removing the new duplex settings from the interface template and just using cmds to hard code? the issue will be if a person were to update the interface description for example, NDFC will try to remove the duplex setting as the template knows nothing about it.
Yes that is what I am suggesting. The cmds
property under the profile
section of the module maps to the Freeform Config
section in NDFC under the interface.
Just a quick note. If you use state: merged
it will try and merge any commands you supply using the cmds
option. If you don't want the commands to be merged, use state:replaced
@xXAzazelXx Just checking if you saw my last response and if you had a chance to try it. NDFC should not remove what you add under the cmds
option.
Hey @mikewiebe ,
Thanks for following up. No sorry I could not get the cmd option to work, as I wanted to also have a GUI drop-down option to keep it all consistent (not just freeform). What I ended up doing is using speed settings as cisco.dcnm.dcnm_interface file manually to make a duplex setting for myself.
Community Note
Description
Would it be please possible to add "duplex" to the cisco.dcnm.dcnm_interface module? At the moment we are unable to specify the duplex setting in cisco.dcnm.dcnm_interface playbooks
New or Affected modules(s):
DCNM version
Potential ansible task config
References
Additional context Add any other context or screenshots about the feature request here.