community.general.oneview_datacenter_info – Retrieve information about the OneView Data Centers
Note
This plugin is part of the community.general collection (version 1.3.2).
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.oneview_datacenter_info.
Synopsis
- Retrieve information about the OneView Data Centers.
- This module was called oneview_datacenter_factsbefore Ansible 2.9, returningansible_facts. Note that the community.general.oneview_datacenter_info module no longer returnsansible_facts!
Requirements
The below requirements are needed on the host that executes this module.
- hpOneView >= 2.0.1
- python >= 2.7.9
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| config  path  | Path to a .json configuration file containing the OneView client configuration. The configuration file is optional and when used should be present in the host running the ansible commands. If the file path is not provided, the configuration will be loaded from environment variables. For links to example configuration files or how to use the environment variables verify the notes section. | |
| name  string  | Data Center name. | |
| options  string  | Retrieve additional information. Options available: 'visualContent'. | |
| params  dictionary  | List of params to delimit, filter and sort the list of resources. params allowed: -  start: The first item to return, using 0-based indexing. -count: The number of resources to return. -filter: A general filter/query string to narrow the list of items returned. -sort: The sort order of the returned data set. | 
Notes
Note
- A sample configuration file for the config parameter can be found at: https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/oneview_config-rename.json
- Check how to use environment variables for configuration at: https://github.com/HewlettPackard/oneview-ansible#environment-variables
- Additional Playbooks for the HPE OneView Ansible modules can be found at: https://github.com/HewlettPackard/oneview-ansible/tree/master/examples
- The OneView API version used will directly affect returned and expected fields in resources. Information on setting the desired API version and can be found at: https://github.com/HewlettPackard/oneview-ansible#setting-your-oneview-version
Examples
- name: Gather information about all Data Centers
  community.general.oneview_datacenter_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  delegate_to: localhost
  register: result
- ansible.builtin.debug:
    msg: "{{ result.datacenters }}"
- name: Gather paginated, filtered and sorted information about Data Centers
  community.general.oneview_datacenter_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    params:
      start: 0
      count: 3
      sort: 'name:descending'
      filter: 'state=Unmanaged'
  register: result
- ansible.builtin.debug:
    msg: "{{ result.datacenters }}"
- name: Gather information about a Data Center by name
  community.general.oneview_datacenter_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    name: "My Data Center"
  delegate_to: localhost
  register: result
- ansible.builtin.debug:
    msg: "{{ result.datacenters }}"
- name: Gather information about the Data Center Visual Content
  community.general.oneview_datacenter_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    name: "My Data Center"
    options:
      - visualContent
  delegate_to: localhost
  register: result
- ansible.builtin.debug:
    msg: "{{ result.datacenters }}"
- ansible.builtin.debug:
    msg: "{{ result.datacenter_visual_content }}"
   Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| datacenter_visual_content  dictionary  | When requested, but can be null. | Has information about the Data Center Visual Content. | 
| datacenters  dictionary  | Always, but can be null. | Has all the OneView information about the Data Centers. | 
Authors
- Alex Monteiro (@aalexmonteiro)
- Madhav Bharadwaj (@madhav-bharadwaj)
- Priyanka Sood (@soodpr)
- Ricardo Galeno (@ricardogpsf)
    © 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
    https://docs.ansible.com/ansible/2.10/collections/community/general/oneview_datacenter_info_module.html