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

oneview_server_hardware: hostname is not a valid field #703

Closed liamwh closed 3 years ago

liamwh commented 3 years ago

Scenario/Intent

Ensure Server Hardware Compliance

Environment Details

[root@375c9d41528c ansible]# ansible --version
ansible 2.9.22
  config file = /mnt/ansible/ansible.cfg
  configured module search path = ['/mnt/ansible/library']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Mar 18 2021, 08:58:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]

Steps to Reproduce

- name: (HPE) Ensure Server Hardware Compliance
  hpe.oneview.oneview_server_hardware:
    hostname: "{{ oneview_address }}"
    username: "{{ oneview_username }}"
    password: "{{ oneview_password }}"
    auth_login_domain: "{{ oneview_auth_login_domain }}"
    api_version: "{{ oneview_api_version }}"
    state: "{{ oneview_server_hardware_compliance_state }}"
    data:
      name: "{{ management_card_hostname }}"
  delegate_to: localhost

Expected Result

hostname to be a valid field. In a previous version of the module the ansible field was name.

Actual Result

image

If using name instead of hostname: image

liamwh commented 3 years ago

According to the docs the param should be hostname, but according to the API the param should be name.

VenkateshRavula commented 3 years ago

Hi @liamwh, What is the state you have used for compliance..? Your playbook shows the variable name for state. Can you please disclose that state value so that I can start my debugging with that. state: "{{ oneview_server_hardware_compliance_state }}"

If you are speaking about the below piece of code, then I have tried it with "name" and it worked perfectly for me. https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/oneview_server_hardware.yml#L117-L123

image Also as per your configuration, it shows python-hpOneView SDK Version: 0.15.2 as python module which is not compatible with our collections.

Can you please confirm the requested info.

liamwh commented 3 years ago

I'm not sure where I got the value for the python-hpOneView SDK version, however after updating ansible to version 2.10.11 and using the hostname parameter (not name), the module worked successfully.