community.vmware.vmware_host_feature_info 模块 – 收集有关 ESXi 主机功能的信息
注意
此模块是 community.vmware 集合(版本 5.2.0)的一部分。
如果您正在使用 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.vmware
。
要在 Playbook 中使用它,请指定:community.vmware.vmware_host_feature_info
。
概要
当给定 ESXi 主机名或集群名称时,此模块可用于收集有关 ESXi 主机功能的信息。
参数
参数 |
注释 |
---|---|
用于信息收集的所有主机系统的集群名称。 如果未给定 |
|
要从中收集信息的 ESXi 主机名。 如果未给定 |
|
vSphere vCenter 或 ESXi 服务器的主机名或 IP 地址。 如果任务中未指定该值,则将使用环境变量 |
|
vSphere vCenter 或 ESXi 服务器的密码。 如果任务中未指定该值,则将使用环境变量 |
|
将接收所有 HTTPS 请求并转发它们的 HTTP 代理的端口。 如果任务中未指定该值,则将使用环境变量 |
|
vSphere vCenter 或 ESXi 服务器的用户名。 如果任务中未指定该值,则将使用环境变量 |
|
允许在 SSL 证书无效时进行连接。当证书不受信任时,设置为 如果任务中未指定该值,则将使用环境变量 选择
|
注意
注意
所有模块都需要 API 写入权限,因此不支持免费的 ESXi 许可证。
所有变量和 VMware 对象名称都区分大小写。
示例
- name: Gather feature capability info about all ESXi Hosts in given Cluster
community.vmware.vmware_host_feature_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_cluster_hosts_info
- name: Check if ESXi is vulnerable for Speculative Store Bypass Disable (SSBD) vulnerability
community.vmware.vmware_host_feature_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
register: features_set
- set_fact:
ssbd : "{{ item.value }}"
loop: "{{ features_set.host_feature_info[esxi_hostname] |json_query(name) }}"
vars:
name: "[?key=='cpuid.SSBD']"
- assert:
that:
- ssbd|int == 1
when: ssbd is defined
返回值
常见的返回值记录在此处,以下是此模块独有的字段
键 |
描述 |
---|---|
有关主机功能信息的元数据 已返回: 始终 示例: |