community.vmware.vmware_datastore_info 模块 – 收集给定 vCenter 中可用数据存储的信息
注意
此模块是 community.vmware 集合 (版本 5.2.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.vmware
。
要在 playbook 中使用它,请指定: community.vmware.vmware_datastore_info
。
概要
此模块可用于收集有关 VMware 基础架构中数据存储的信息。
参数
参数 |
注释 |
---|---|
要搜索数据存储的数据中心。 如果未提供 |
|
vSphere vCenter 或 ESXi 服务器的主机名或 IP 地址。 如果任务中未指定值,则将改用环境变量 |
|
要匹配的数据存储的名称。 如果设置,则返回特定数据存储的信息。 |
|
vSphere vCenter 或 ESXi 服务器的密码。 如果任务中未指定值,则将改用环境变量 |
|
指定要检索的属性。 如果未指定,则检索所有属性(深度检索)。 结果以与 vsphere API 相同的结构返回。 示例 properties: [ “name”, “info.vmfs.ssd”, “capability.vsanSparseSupported”, “overallStatus” ] 仅当 |
|
将接收所有 HTTPS 请求并转发它们的 HTTP 代理的端口。 如果任务中未指定值,则将改用环境变量 |
|
指定所需的输出模式。 “summary”输出模式是模块的旧版输出 “vsphere”输出模式是 vSphere API 类定义 选项
|
|
如果设置为 选项
|
|
vSphere vCenter 或 ESXi 服务器的用户名。 如果任务中未指定值,则将改用环境变量 |
|
允许在 SSL 证书无效时连接。当证书不受信任时,设置为 如果任务中未指定值,则将改用环境变量 选项
|
备注
注意
所有模块都需要 API 写入权限,因此在免费 ESXi 许可证上不支持。
所有变量和 VMware 对象名称都区分大小写。
示例
- name: Gather info from standalone ESXi server having datacenter as 'ha-datacenter'
community.vmware.vmware_datastore_info:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
datacenter_name: "ha-datacenter"
delegate_to: localhost
register: info
- name: Gather info from datacenter about specific datastore
community.vmware.vmware_datastore_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
name: datastore1
delegate_to: localhost
register: info
- name: Gather some info from a datastore using the vSphere API output schema
community.vmware.vmware_datastore_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
schema: vsphere
properties:
- name
- info.vmfs.ssd
- capability.vsanSparseSupported
- overallStatus
delegate_to: localhost
register: info
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
关于可用数据存储的元数据 返回值:始终返回 示例: |