Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Sneedes opened this issue Jun 21, 2019 · 4 comments
Open

Comments

@Sneedes
Copy link

Sneedes commented Jun 21, 2019

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

`

  • name: Add VLANs to the vNIC Template vm-network-a
    ucs_vnic_template:
    hostname: "{{ inventory_hostname }}"
    username: "{{ ucs_username }}"
    password: "{{ ucs_password }}"
    org_dn: "{{ ucs_org_dn }}"
    name: vm-network-a
    vlans_list: "{{ my_vlans}}"
    `

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
Copy link
Author

Sneedes commented Jun 21, 2019

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
Copy link

ef83 commented Jun 25, 2019

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
Copy link
Author

Sneedes commented Jun 26, 2019

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
Copy link

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

host_vars

demo_lan_conn:

  • { order: 1, name: "manageA", template: "vnic-manage-A", policy: "VMWare"}
  • { order: 2, name: "manageB", template: "vnic-manage-B", policy: "VMWare"}
  • { order: 3, name: "migrateA", template: "vnic-migrate-A", policy: "VMWare"}
  • { order: 4, name: "migrateB", template: "vnic-migrate-B", policy: "VMWare"}
  • { order: 5, name: "storageA", template: "vnic-storage-A", policy: "VMWare"}
  • { order: 6, name: "storageB", template: "vnic-storage-B", policy: "VMWare"}
  • { order: 7, name: "dataA", template: "vnic-data-A", policy: "VMWare"}
  • { order: 8, name: "dataB", template: "vnic-data-B", policy: "VMWare"}

play.yaml

  • name: Create LAN Connectivity Template
    ucs_lan_connectivity:
    name: "{{ lan_conn_policy.name }}"
    description: "{{ lan_conn_policy.description }}"
    vnic_list:
    - name: "{{ item.name }}"
    vnic_template: "{{ item.template }}"
    adapter_policy: "{{ item.policy }}"
    order: "{{ item.order }}"
    org_dn: "{{ this_ucs_org }}"
    hostname: "{{ this_ucs_hostname }}"
    username: "{{ this_ucs_username }}"
    password: "{{ this_ucs_password }}"
    loop: "{{ demo_lan_conn }}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants