CiscoUcs / ucsm-ansible

Ansible Modules for Cisco Ucs Managed Blade and Rack servers.
58 stars 44 forks source link

ucs_vnic_template: setup error: 'NoneType' object has no attribute 'status' #113

Open Sneedes opened 5 years ago

Sneedes commented 5 years ago

Attempting to add vlans to a VNIC template.
Results in "setup error: 'NoneType' object has no attribute 'status'" error.

`

Here's a snippet from the execution of the play:

` Using module file /usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_vnic_template.py

The full traceback is: WARNING: The below traceback may not be related to the actual failure. File "/tmp/ansible_ucs_vnic_template_payload_CV5HWj/main.py", line 354, in main ucs.login_handle.remove_mo(mo_1) File "/usr/lib/python2.7/site-packages/ucsmsdk/ucshandle.py", line 696, in remove_mo mo.status = "deleted"

fatal: [ucsm.hostname.com]: FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "invocation": { "module_args": { "cdn_name": "", "cdn_source": "vnic-name", "description": "", "fabric": "A", "hostname": "ucsm.hostname.com", "mac_pool": "", "mtu": "1500", "name": "vm-network-a", "network_control_policy": "", "org_dn": "org-root/org-MyCluster", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "peer_redundancy_template": "", "pin_group": "", "port": null, "proxy": null, "qos_policy": "", "redundancy_type": "none", "state": "present", "stats_policy": "default", "target": "adaptor", "template_type": "initial-template", "use_proxy": true, "use_ssl": true, "username": "admin", "vlans_list": [ { "id": "99", "name": "VLAN0099-My-VLAN", "native": "no", "state": "present" } ] } }, "msg": "setup error: 'NoneType' object has no attribute 'status' " } `

Sneedes commented 5 years ago

Noting...is the related to my my_vlans list? The docs say that vlans_list is a list of VLANs...with name, native, and state. Any way related to my list having an id element in this case?

  - { id: '99',   name: 'VLAN0099-My-VLAN',          native: 'no'}
ef83 commented 5 years ago

I believe you answered your own question, the 'id' is not a valid property. I'm assuming thats your VLAN id...you must create the VLANs before creating the vnic templates. VLAN creation is where the ID is specified.

ucs_vlans: <<: *login_info name: Data_VLAN id: '11'

Sneedes commented 5 years ago

But can I not provide a list/dictionary as the vlans_list that happens to contain more properties than required? I'm trying to be lazy and consistent by using a single variable to create the vlans as well as assign the exact same list to the vnic template.

gve-vse-tim commented 4 years ago

Here's how I do this. Don't know if it helps.

host_vars

demo_lan_conn:

play.yaml