community.general.oneview_enclosure_info 模块 – 获取一个或多个机箱的信息
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在剧本中使用它,请指定:community.general.oneview_enclosure_info。
概要
- 从 OneView 中检索一个或多个机箱的信息。 
要求
执行此模块的主机需要以下要求。
- Python >= 2.7.9 
- hpOneView >= 2.0.1 
参数
| 参数 | 注释 | 
|---|---|
| OneView API 版本。 | |
| 包含 OneView 客户端配置的 JSON 配置文件的路径。配置文件是可选的,使用时应存在于运行 Ansible 命令的主机上。如果未提供文件路径,则配置将从环境变量加载。有关示例配置文件的链接或如何使用环境变量,请验证注释部分。 | |
| 设备的 IP 地址或主机名。 | |
| HPE Image Streamer REST API 的 IP 地址或主机名。 | |
| 机箱名称。 | |
| 包含选项的列表,用于收集有关机箱和相关资源的附加信息。允许的选项: | |
| 用于限定、过滤和排序资源列表的参数列表。 允许的参数键为 
 
 
 
 | |
| API 身份验证密码。 | |
| API 身份验证用户名。 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 在 community.general 3.3.0 中添加 此操作不会修改状态。 | 可以在  | |
| 支持: N/A 此操作不会修改状态。 | 在差异模式下,将返回有关已更改内容(或可能需要在  | 
注释
注意
- 可在以下位置找到 config 参数的示例配置文件:https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/oneview_config-rename.json 
- 查看如何在以下位置使用环境变量进行配置:https://github.com/HewlettPackard/oneview-ansible#environment-variables 
- 可在以下位置找到 HPE OneView Ansible 模块的其他剧本:https://github.com/HewlettPackard/oneview-ansible/tree/master/examples 
- 使用的 OneView API 版本将直接影响资源中返回和预期的字段。有关设置所需 API 版本的信息可在以下位置找到:https://github.com/HewlettPackard/oneview-ansible#setting-your-oneview-version 
示例
- name: Gather information about all Enclosures
  community.general.oneview_enclosure_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result
- name: Print fetched information about Enclosures
  ansible.builtin.debug:
    msg: "{{ result.enclosures }}"
- name: Gather paginated, filtered and sorted information about Enclosures
  community.general.oneview_enclosure_info:
    params:
      start: 0
      count: 3
      sort: name:descending
      filter: status=OK
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result
- name: Print fetched information about paginated, filtered and sorted list of Enclosures
  ansible.builtin.debug:
    msg: "{{ result.enclosures }}"
- name: Gather information about an Enclosure by name
  community.general.oneview_enclosure_info:
    name: Enclosure-Name
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result
- name: Print fetched information about Enclosure found by name
  ansible.builtin.debug:
    msg: "{{ result.enclosures }}"
- name: Gather information about an Enclosure by name with options
  community.general.oneview_enclosure_info:
    name: Test-Enclosure
    options:
      - script                       # optional
      - environmentalConfiguration   # optional
      - utilization                  # optional
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result
- name: Print fetched information about Enclosure found by name
  ansible.builtin.debug:
    msg: "{{ result.enclosures }}"
- name: Print fetched information about Enclosure Script
  ansible.builtin.debug:
    msg: "{{ result.enclosure_script }}"
- name: Print fetched information about Enclosure Environmental Configuration
  ansible.builtin.debug:
    msg: "{{ result.enclosure_environmental_configuration }}"
- name: Print fetched information about Enclosure Utilization
  ansible.builtin.debug:
    msg: "{{ result.enclosure_utilization }}"
- name: "Gather information about an Enclosure with temperature data at a resolution of one sample per day, between two
         specified dates"
  community.general.oneview_enclosure_info:
    name: Test-Enclosure
    options:
      - utilization:                   # optional
          fields: AmbientTemperature
          filter:
            - startDate=2016-07-01T14:29:42.000Z
            - endDate=2017-07-01T03:29:42.000Z
          view: day
          refresh: false
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result
- name: Print fetched information about Enclosure found by name
  ansible.builtin.debug:
    msg: "{{ result.enclosures }}"
- name: Print fetched information about Enclosure Utilization
  ansible.builtin.debug:
    msg: "{{ result.enclosure_utilization }}"
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 包含有关机箱环境配置的所有 OneView 信息。 返回:请求时返回,但可能为空。 | |
| 包含有关机箱脚本的所有 OneView 信息。 返回:请求时返回,但可能为空。 | |
| 包含有关机箱利用率的所有 OneView 信息。 返回:请求时返回,但可能为空。 | |
| 包含有关机箱的所有 OneView 信息。 返回:始终返回,但可能为空。 | 
