HewlettPackard / oneview-ansible

This project is no longer being developed and has limited support. Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection
Apache License 2.0
104 stars 65 forks source link

Add support for setting "server name" and "server profle" in oneview_server_hardware module #709

Open johnpaulsen1 opened 9 months ago

johnpaulsen1 commented 9 months ago

Scenario/Intent

When I add a new server hardware, I want to be able to also set:

At the moment it appears that I am unable to set those params in the "data" dictionary in the oneview_server_hardware module.

It will be much appreciated if you can this functionality. So that when I add a new server I don't need to manually edit it and populate the "Server Name" and "Server Profile".

Environment Details

Steps to Reproduce

When I try set the suggested keys (serverName, serverProfileUri) and their value pairs in the "data" dictionary, my ansible play fails. See ansible playbook task below:

- name: "Add server hardware to HPE OneView"
  oneview_server_hardware:
    config: "{{ config }}"
    state: present
    data:
      servername: "test_hostname"
      serverprofileuri: "test_hostname_profile"
      hostname: "10.10.10.10"
      username: "ilo_user"
      password: "ilo_password"
      force: false
      licensingIntent: "OneView"
      configurationState: "Managed"
      initialScopeUris: 
        - "{{ scopes[0].uri }}"

ansible play fails with:

'The field named servername near line 1, column 17 is not a valid field in this JSON object.

Expected Result

Adds my server with the "Server Name" and "Server Profile" set.

Actual Result

I'm able to successfully add my server if I exclude my suggested keys, though I need to then manually set the "Server Name" and "Server Profile", as those are "not set" once the play is done adding my server. See screenshot below of this: image