CiscoUcs / ucsm-ansible

Ansible Modules for Cisco Ucs Managed Blade and Rack servers.
59 stars 43 forks source link

ucs_service_profile_template.py Binding LAN connectivity Policy to Service Profile Template error #98

Closed gidami closed 6 years ago

gidami commented 6 years ago

Hi everyone,

I am experiencing some issues with binding a LAN connectivity policy to a Service Profile Template when the latter is manually created (GUI). If the ST Profile is created and later updated by the ansible module, then it's all fine.

The full traceback is:
  File "/var/folders/5l/wgnnz5dx703_hnhh30bcpjqh0000gn/T/ansible_OPOGXi/ansible_module_ucs_service_profile_template.py", line 426, in main
    ucs.login_handle.commit()
  File "/usr/local/lib/python2.7/site-packages/ucsmsdk/ucshandle.py", line 942, in commit
    raise UcsException(response.error_code, response.error_descr)

failed: [evr-no-ccd1] (item={u'state': u'present', u'lan_conn_policy': u'test_template', u'name': u'test-template', u'org_dn': u'org-root/org-VMware'}) => {
    "changed": false,
    "invocation": {
        "module_args": {
            "bios_policy": "",
            "boot_policy": "default",
            "description": "",
            "graphics_card_policy": "",
            "host_firmware_package": "",
            "hostname": "10.123.13.4",
            "ipmi_access_profile": "",
            "kvm_mgmt_policy": "",
            "lan_connectivity_policy": "test_template",
            "local_disk_policy": "",
            "maintenance_policy": "",
            "mgmt_inband_pool_name": "",
            "mgmt_interface_mode": "",
            "mgmt_ip_pool": "ext-mgmt",
            "mgmt_vnet_name": "",
            "name": "test-template",
            "org_dn": "org-root/org-VMware",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "power_control_policy": "default",
            "power_state": "up",
            "power_sync_policy": "",
            "proxy": null,
            "san_connectivity_policy": "",
            "scrub_policy": "",
            "server_pool": "",
            "server_pool_qualification": "",
            "sol_policy": "",
            "state": "present",
            "storage_profile": "",
            "template_type": "initial-template",
            "threshold_policy": "default",
            "use_proxy": true,
            "use_ssl": true,
            "user_label": "",
            "username": "ucs-local\\ansibleuser",
            "uuid_pool": "default",
            "vmedia_policy": ""
        }
    },
    "item": {
        "lan_conn_policy": "test_template",
        "name": "test-template",
        "org_dn": "org-root/org-VMware",
        "state": "present"
    },
    "msg": "setup error: [ErrorCode]: 170[ErrorDescription]: Create-only and naming props cannot be modified after creation, class=lsServer, prop=type\n "
}

Any explanation or suggestion is most appreciated. Thank you.

gidami commented 6 years ago

Hi. I have found that template_type is set to initial-template by the module when not explicitly defined and that does not work well with existing Service Profile Templates set in updating-template.

Once template_type is set to updating-template, then I was able to add the LAN Connectivity Policy to existing Service Profile Template.

Thank you!