Closed dobey-xx closed 1 year ago
Hi Could you please confirm if you are creating server profile within a scope? If not could you please try the same.
Thanks
Hi,
According to this example, there is no need to set an scope uri.
And if I try to use the parameter "InitialScopeUris", it throws the following error:
File \"/var/lib/awx/venv/env/lib/python3.6/site-packages/hpeOneView/connection.py\", line 413, in __do_rest_call\n raise HPEOneViewException(body)\nhpeOneView.exceptions.HPEOneViewException: ('Unrecognized JSON field.', {'errorCode': 'UNRECOGNIZED_JSON_FIELD', 'message': 'Unrecognized JSON field.', 'details': 'The field named ServerHardwareTypeName near line 1, column 175 is not a valid field in this JSON object.', 'messageParameters': [], 'recommendedActions': ['Check the valid fields for this JSON object and remove or correct the unrecognized field.'], 'errorSource': None, 'nestedErrors': [], 'data': {}})\n",
Hi,
Please confirm the username which you are using.
Hi,
I'm using this username: awxacc, this user has the role: infrastructure administrator
Strange thing is, if I removed the parameter: ServerHardwareTypeName, it gives the following error: HPEOneViewTaskError(msg, error_code)\nhpeOneView.exceptions.HPEOneViewTaskError: The server hardware type null is not valid or not supported.\n
But when I add it again it gives: 'The field named ServerHardwareTypeName near line 1, column 175 is not a valid field in this JSON object.', 'messageParameters': [], 'recommendedActions': ['Check the valid fields for this JSON object and remove or correct the unrecognized field.']
Small update: When I use a template to create a server profile it seems to work, but the example without a server template doesn't work.
Hi,
We understood the issue and have pushed the changes to branch sp_issue_219. Please confirm if it works fine for you.
I've changed the python file in my locally pulled collection. The error is still the same, this is the stderr output:
"exception": "Traceback (most recent call last):\n File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1666083337.685405-476-235430583536718/AnsiballZ_oneview_server_profile.py\", line 102, in
Hi,
Please follow the example file without any changes and kindly share the exact task which you are getting this error. It will help me to debug your issue further.
Thanks
Hi,
I've did some reverse engineering and it seems the provided example isn't correct.
The error states that there are unrecognized JSON fields,
I've changed that to:
And the profile is created,
From the above discussion, it seems you are trying multiple ways to create server profiles.
For server profile creation, either serverHardwareTypeName/serverHardwareName can be passed as input.
In case of serverHardwareName, it will search for server hardware of that name to assign it to the profile. And in case of serverHardwareTypeName it will use this type to fetch available server of that type for auto assignment of server hardware.
Field enclosureGroupName depends on the environment which you are trying, enclosureGroupName is valid for synergy and not available for rack servers.
we do feel our examples are not correctly explaining all the scenarios...we will work on it.
Thanks
From my experience so far, i'm unable to use serverHardwareTypename without the use of a serverProfileTemplate. It just doesn't accept the json format.
This example worked for me:
name: Create Server Profile without specifying a template oneview_server_profile: config: "{{ config }}" sessionID: "{{ session.ansible_facts.session }}" data: name: "{{ contents.server_profile.inventory_hostname }}" serverHardwareName: "enclosure, bay" serialNumberType: "Phyiscal" description: "{{ contents.server_profile.server_profile_description }}" delegate_to: localhost
Getting the follow error when trying to create a profile:
"/tmp/ansible_hpe.oneview.oneview_server_profile_payload_kih52j/ansible_hpe.oneview.oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py", line 337, in present\n File "/tmp/ansible_hpe.oneview.oneview_server_profile_payload_kih52j/ansible_hpe.oneview.oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py", line 467, in create_profile\n File "/tmp/ansible_hpe.oneview.oneview_server_profile_payload_kih52j/ansible_hpe.oneview.oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py", line 702, in _auto_assign_server_profile\n File "/tmp/ansible_hpe.oneview.oneview_server_profile_payload___kih52j/ansible_hpe.oneview.oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py", line 556, in get_available_server_hardware_uri\nTypeError: sequence item 0: expected str instance, NoneType found\n",
It's in a test environment so the user is Infrastructure admin.
I followed the example as described here: https://github.com/HewlettPackard/oneview-ansible-collection/blob/master/roles/oneview_server_profile/tasks/main.yml