CiscoDevNet / ansible-ucs

Cisco UCS Ansible Collection
MIT License
13 stars 6 forks source link

cisco.ucs.ucs_vnic_template #24

Open TDC-MJU opened 3 years ago

TDC-MJU commented 3 years ago

Hi there when i use cisco.ucs.ucs_vnic_template to update a vnic template, i can see that any settings that is not defined in the playbook,will be set to default. In my case, LLDP profile and QOS profile will be set to default (none)

bakrir commented 3 years ago

Hi @TDC-MJU ,

Sounds like you are trying to change some LLDP and QOS profile settings. If you have a look at the ucs_vnic_template module (or python code) directly, it takes the following parameters:

    argument_spec.update(
        org_dn=dict(type='str', default='org-root'),
        name=dict(type='str', required=True),
        description=dict(type='str', aliases=['descr'], default=''),
        fabric=dict(type='str', default='A', choices=['A', 'B', 'A-B', 'B-A']),
        redundancy_type=dict(type='str', default='none', choices=['none', 'primary', 'secondary']),
        peer_redundancy_template=dict(type='str', aliases=['peer_redundancy_templ'], default=''),
        target=dict(type='str', default='adapter', choices=['adapter', 'vm']),
        template_type=dict(type='str', default='initial-template', choices=['initial-template', 'updating-template']),
        vlans_list=dict(type='list'),
        cdn_source=dict(type='str', default='vnic-name', choices=['vnic-name', 'user-defined']),
        cdn_name=dict(type='str', default=''),
        mtu=dict(type='str', default='1500'),
        mac_pool=dict(type='str', default=''),
        qos_policy=dict(type='str', default=''),
        network_control_policy=dict(type='str', default=''),
        pin_group=dict(type='str', default=''),
        stats_policy=dict(type='str', default='default'),
        state=dict(type='str', default='present', choices=['present', 'absent']),
    )

Based on the above, I don't think LLDP is optional parameter (future PR maybe?) but you can change the qos_policy. You can see default='' is what will be used if a value is not set. Here is an example that includes those parameters:

- name: TEST-vNIC0
  fabric: A-B
  descr: 
  template_type: updating-template
  mac_pool: MAC-A
  network_control_policy: default
  parent_mo_or_dn: org-root/org-TEST
  mtu: '9000'
  qos_policy: 'MTU'
  vlans_list:
  - name: VLAN10
    native: 'yes'

I hope that helps.

Adam8005 commented 3 years ago

Yeah, definitely just ran into this. Everything was reset template type, mac pool, etc. That was a bit unexpected when I was just adding a vlan to the vnic.

nurseandthenerd commented 5 months ago

This definitely needs to be fixed. This bug took down almost our whole organization. We automated adding/removing vlans from ucs, which included vlan groups. the code removes the vlan from the vnic template but because we only had the vlan_list defined and not template_type it changed the template type from updating to initil, then the vlan was removed from the vlan group and all of the service profiles associated with the vnic templates unpinned their nics because the Service Profiles didn't update when the vlan was removed from the vnic template and couldn't pin to an interface.