community.general.redfish_info 模块 – 使用 Redfish API 管理带外控制器

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.general

要在 Playbook 中使用它,请指定:community.general.redfish_info

概要

  • 在本地构建 Redfish URI,并将它们发送到远程 OOB 控制器以获取信息。

  • 检索到的信息将放置在用户指定的位置。

参数

参数

注释

auth_token

字符串

在 community.general 2.3.0 中添加

用于向 OOB 控制器进行身份验证的安全令牌。

baseuri

字符串 / 必需

OOB 控制器的基本 URI。

category

列表 / 元素=字符串

要在 OOB 控制器上执行的类别列表。

默认值: ["Systems"]

ciphers

列表 / 元素=字符串

在 community.general 9.2.0 中添加

用于请求的 SSL/TLS 密码。

当提供列表时,所有密码将按顺序使用 : 连接。

有关更多详细信息,请参阅 OpenSSL 密码列表格式

可用密码取决于 Python 和 OpenSSL/LibreSSL 版本。

command

列表 / 元素=字符串

要在 OOB 控制器上执行的命令列表。

manager

字符串

在 community.general 8.3.0 中添加

要定位的 OOB 控制器上的管理器名称。

password

字符串

用于向 OOB 控制器进行身份验证的密码。

timeout

整数

向 OOB 控制器发出 HTTP 请求的超时时间(以秒为单位)。

此参数的默认值从 community.general 9.0.0 中的 10 更改为 60

默认值: 60

update_handle

字符串

在 community.general 6.1.0 中添加

用于检查正在进行的更新状态的句柄。

username

字符串

用于向 OOB 控制器进行身份验证的用户名。

属性

属性

支持

描述

check_mode

支持: 完全

在 community.general 3.3.0 中添加

此操作不修改状态。

可以在 check_mode 中运行并返回已更改状态的预测,而无需修改目标。

diff_mode

支持: 不适用

此操作不修改状态。

在 diff 模式下运行时,将返回有关已更改的内容(或在 check_mode 中可能需要更改的内容)的详细信息。

示例

- name: Get CPU inventory
  community.general.redfish_info:
    category: Systems
    command: GetCpuInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.cpu.entries | to_nice_json }}"

- name: Get CPU model
  community.general.redfish_info:
    category: Systems
    command: GetCpuInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.cpu.entries.0.Model }}"

- name: Get memory inventory
  community.general.redfish_info:
    category: Systems
    command: GetMemoryInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Get fan inventory with a timeout of 20 seconds
  community.general.redfish_info:
    category: Chassis
    command: GetFanInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    timeout: 20
  register: result

- name: Get Virtual Media information
  community.general.redfish_info:
    category: Manager
    command: GetVirtualMedia
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}"

- name: Get Virtual Media information from Systems
  community.general.redfish_info:
    category: Systems
    command: GetVirtualMedia
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}"

- name: Get Volume Inventory
  community.general.redfish_info:
    category: Systems
    command: GetVolumeInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result
- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.volume.entries | to_nice_json }}"

- name: Get Session information
  community.general.redfish_info:
    category: Sessions
    command: GetSessions
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result

- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts.session.entries | to_nice_json }}"

- name: Get default inventory information
  community.general.redfish_info:
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
  register: result
- name: Print fetched information
  ansible.builtin.debug:
    msg: "{{ result.redfish_facts | to_nice_json }}"

- name: Get several inventories
  community.general.redfish_info:
    category: Systems
    command: GetNicInventory,GetBiosAttributes
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get default system inventory and user information
  community.general.redfish_info:
    category: Systems,Accounts
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get default system, user and firmware information
  community.general.redfish_info:
    category: ["Systems", "Accounts", "Update"]
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get Manager NIC inventory information
  community.general.redfish_info:
    category: Manager
    command: GetManagerNicInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get boot override information
  community.general.redfish_info:
    category: Systems
    command: GetBootOverride
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get chassis inventory
  community.general.redfish_info:
    category: Chassis
    command: GetChassisInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get all information available in the Manager category
  community.general.redfish_info:
    category: Manager
    command: all
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get firmware update capability information
  community.general.redfish_info:
    category: Update
    command: GetFirmwareUpdateCapabilities
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get firmware inventory
  community.general.redfish_info:
    category: Update
    command: GetFirmwareInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get service identification
  community.general.redfish_info:
    category: Manager
    command: GetServiceIdentification
    manager: "{{ manager }}"
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get software inventory
  community.general.redfish_info:
    category: Update
    command: GetSoftwareInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get the status of an update operation
  community.general.redfish_info:
    category: Update
    command: GetUpdateStatus
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    update_handle: /redfish/v1/TaskService/TaskMonitors/735

- name: Get Manager Services
  community.general.redfish_info:
    category: Manager
    command: GetNetworkProtocols
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get all information available in all categories
  community.general.redfish_info:
    category: all
    command: all
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get system health report
  community.general.redfish_info:
    category: Systems
    command: GetHealthReport
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get chassis health report
  community.general.redfish_info:
    category: Chassis
    command: GetHealthReport
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get manager health report
  community.general.redfish_info:
    category: Manager
    command: GetHealthReport
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get manager Redfish Host Interface inventory
  community.general.redfish_info:
    category: Manager
    command: GetHostInterfaces
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get Manager Inventory
  community.general.redfish_info:
    category: Manager
    command: GetManagerInventory
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get HPE Thermal Config
  community.general.redfish_info:
    category: Chassis
    command: GetHPEThermalConfig
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get HPE Fan Percent Minimum
  community.general.redfish_info:
    category: Chassis
    command: GetHPEFanPercentMin
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Get BIOS registry
  community.general.redfish_info:
    category: Systems
    command: GetBiosRegistries
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Check the availability of the service with a timeout of 5 seconds
  community.general.redfish_info:
    category: Service
    command: CheckAvailability
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    timeout: 5
  register: result

返回值

常见返回值在此处记录 这里,以下是此模块特有的字段

描述

result

字典

根据任务的不同而有不同的结果

返回值: 总是

示例: "系统上的 CPU 列表"

作者

  • Jose Delarosa (@jose-delarosa)