Failure to create a Server profile template
jullienl opened this issue · comments
Lionel Jullien commented
I want to create a Server profile template with boot from SAN storage volumes created upon profile creation from this template
but what ever I try, I always get an exception: HPEOneViewTaskError: One or more required fields are missing. Volume "ESXi_Boot" with attachment ID 1.
I have provided all the required parameters as per the REST API reference, but the failure persists.
What am I missing?
Playbook :
---
- name: Server profile template for VMware ESXi 7 with boot from SAN storage volumes created upon profile creation from this template
hosts: localhost
collections:
- hpe.oneview
gather_facts: no
vars:
config: "{{ playbook_dir }}/oneview_config.json"
server_profile_template_name: "ESX BFS"
server_hardware_type_name: "SY 480 Gen10 1"
enclosure_group_name: "EG"
connection_network_management_name: "Management-Nexus"
connection_fabric_A_name: "FC-A"
connection_fabric_B_name: "FC-B"
connection_network_set_name: "Production_network_set"
StorageSystemUri: "/rest/storage-systems/MXN6380203"
Storage_pool_uri: "/rest/storage-pools/F8AA36B9-CE0B-46B7-8CC8-AD8000E62B87"
firmwareBaselineUri: "/rest/firmware-drivers/Synergy_Service_Pack_SSP_2021_05_03_Z7550-97224"
tasks:
- name: Create a server profile template for VMware ESXi
oneview_server_profile_template:
config: "{{ config }}"
state: present
data:
serverProfileDescription: "Server profile template for VMware ESXi 7 with boot from SAN storage volumes created upon profile creation from this template"
boot:
complianceControl: Checked
manageBoot: true
order:
- HardDisk
bootMode:
complianceControl: Checked
manageMode: true
mode: UEFIOptimized
pxeBootPolicy: Auto
name: "{{ server_profile_template_name }}"
bios:
complianceControl: Checked
manageBios: true
overriddenSettings:
- id: WorkloadProfile
value: Virtualization-MaxPerformance
- id: MinProcIdlePower
value: NoCStates
- id: IntelUpiPowerManagement
value: Disabled
- id: MinProcIdlePkgState
value: NoState
- id: EnergyPerfBias
value: MaxPerf
- id: UncoreFreqScaling
value: Maximum
- id: PowerRegulator
value: StaticHighPerf
- id: SubNumaClustering
value: Enabled
- id: CollabPowerControl
value: Disabled
- id: EnergyEfficientTurbo
value: Disabled
- id: NumaGroupSizeOpt
value: Clustered
serverHardwareTypeName: "{{ server_hardware_type_name }}"
enclosureGroupName: "{{ enclosure_group_name }}"
firmware:
complianceControl: Checked
firmwareActivationType: Immediate
firmwareBaselineUri: "{{ firmwareBaselineUri }}"
firmwareInstallType: FirmwareOnlyOfflineMode
forceInstallFirmware: false
manageFirmware: true
connectionSettings:
complianceControl: Checked
manageConnections: true
connections:
- id: 1
name: Mgmt1
functionType: Ethernet
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_network_management_name }}"
- id: 2
name: Mgmt2
functionType: Ethernet
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_network_management_name }}"
- id: 3
name: FC-A
functionType: FibreChannel
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_fabric_A_name }}"
boot:
priority: LoadBalanced
bootVolumeSource: ManagedVolume
#bootVlanId: ""
#targets: []
- id: 4
name: FC-B
functionType: FibreChannel
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_fabric_B_name }}"
boot:
priority: LoadBalanced
bootVolumeSource: ManagedVolume
#bootVlanId: ""
#targets: []
- id: 5
name: NetworkSet1
functionType: Ethernet
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_network_set_name }}"
- id: 6
name: NetworkSet2
functionType: Ethernet
portId: Auto
requestedMbps: 2500
networkName: "{{ connection_network_set_name }}"
sanStorage:
complianceControl: CheckedMinimum
hostOSType: "VMware (ESXi)"
manageSanStorage: true
sanSystemCredentials: []
volumeAttachments:
- bootVolumePriority: Primary
id: 1
isPermanent: True
lun: ""
lunType: Auto
storagePaths:
- connectionId: 3
isEnabled: true
targetSelector: Auto
#networkUri: "/rest/fc-networks/be06e274-d7c9-48a9-a3e9-92576677ca1f"
targets: []
- connectionId: 4
isEnabled: true
targetSelector: Auto
#networkUri: "/rest/fc-networks/2471664d-70f6-4ba5-9836-817a5dcb7d8e"
targets: []
volume:
#initialScopeUris: []
properties:
description: "OS Boot volume"
isDeduplicated: true
isShareable: false
name: "ESXi_Boot"
provisioningType: Thin
size: 20000
snapshotPool: "{{ Storage_pool_uri }}"
storagePool: "{{ Storage_pool_uri }}"
templateVersion: 1.1
templateUri: ""
volumeStorageSystemUri: "{{ StorageSystemUri }}"
volumeUri: ""
# params:
# force: True # Supported only for API version >= 600
delegate_to: localhost
Output
An exception occurred during task execution.To see the full traceback, use - vvv.The error was: hpeOneView.exceptions.HPEOneViewTaskError: One or more required fields are missing.Volume "ESXi_Boot" with attachment ID 1.
fatal: [localhost->localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1635877105.8914585-83516-63498257904227/AnsiballZ_oneview_server_profile_template.py\", line 102, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1635877105.8914585-83516-63498257904227/AnsiballZ_oneview_server_profile_template.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1635877105.8914585-83516-63498257904227/AnsiballZ_oneview_server_profile_template.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.hpe.oneview.plugins.modules.oneview_server_profile_template', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile_template.py\", line 255, in <module>\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile_template.py\", line 251, in main\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/module_utils/oneview.py\", line 633, in run\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile_template.py\", line 165, in execute_module\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile_template.py\", line 181, in __present\n File \"/tmp/ansible_oneview_server_profile_template_payload_bxhgspj5/ansible_oneview_server_profile_template_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile_template.py\", line 217, in __update\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 67, in wrap\n return obj(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/servers/server_profile_templates.py\", line 137, in update\n self.data = self._helper.update(resource, uri, force, timeout)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 513, in update\n return self.do_put(uri, resource, timeout, custom_headers)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 836, in do_put\n return self._task_monitor.wait_for_task(task, timeout)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/task_monitor.py\", line 82, in wait_for_task\n task_response = self.__get_task_response(task)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/task_monitor.py\", line 142, in __get_task_response\n raise HPEOneViewTaskError(msg, error_code)\nhpeOneView.exceptions.HPEOneViewTaskError: One or more required fields are missing. Volume \"ESXi_Boot\" with attachment ID 1.\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Chebrolu Bala Sai Harika commented
This is due to missing value for templateUri. And templateUri can be captured from /rest/storage-systems/{id}/templates endpoint.
Hence, closing this as @jullienl was able to create SPT successfully after following above procedure.