community.vmware.vmware_deploy_ovf 模块 – 从文件系统或 HTTP 服务器上的 OVF 或 OVA 文件部署 VMware 虚拟机
注意
此模块是 community.vmware 集合 (版本 5.2.0) 的一部分。
如果您使用的是 ansible
包,则您可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.vmware
。
要在 playbook 中使用它,请指定: community.vmware.vmware_deploy_ovf
。
概要
此模块可用于从文件系统或 HTTP 服务器上的 OVF 或 OVA 文件部署 VMware 虚拟机。
参数
参数 |
注释 |
---|---|
是否允许重复的虚拟机名称。ESXi 允许重复,vCenter 可能不允许。 选项
|
|
要部署到的数据中心。 默认值: |
|
要部署到的数据存储。 默认值: |
|
所选部署选项的键。 |
|
磁盘配置类型。 选项
|
|
启用标记为 选项
|
|
使模块将 OVF 导入规范警告视为错误。 选项
|
|
放置虚拟机的文件夹的绝对路径。 如果未指定,则默认为 示例 folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 |
|
vSphere vCenter 或 ESXi 服务器的主机名或 IP 地址。 如果在任务中未指定此值,则将改用环境变量 |
|
强制将给定的属性插入 OVF 环境并通过 VMware Tools 注入。 选项
|
|
要使用的虚拟机的名称。 vCenter 中的虚拟机名称不一定是唯一的,这可能会有问题。 |
|
默认值: |
|
vSphere vCenter 或 ESXi 服务器的密码。 如果任务中未指定此值,则将使用环境变量 |
|
创建虚拟机后是否启动。 选项
|
|
将值分配给 OVF 中找到的属性,采用键值对的形式。 |
|
将接收所有 HTTPS 请求并转发它们的 HTTP 代理的端口。 如果任务中未指定此值,则将使用环境变量 |
|
要部署到的资源池。 默认值: |
|
vSphere vCenter 或 ESXi 服务器的用户名。 如果任务中未指定此值,则将使用环境变量 |
|
允许在 SSL 证书无效时连接。当证书不受信任时,将其设置为 如果任务中未指定此值,则将使用环境变量 选项
|
|
等待主机启动。 选项
|
|
等待 vCenter 检测到虚拟机的 IP 地址。 这需要 vmware-tools (vmtoolsd) 在创建后才能正常工作。 选项
|
备注
注意
如需使用 https 作为源,需要在防火墙中启用 443 端口的入站访问。
所有模块都需要 API 写入权限,因此不受免费 ESXi 许可证的支持。
所有变量和 VMware 对象名称都区分大小写。
示例
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
ovf: /path/to/ubuntu-16.04-amd64.ovf
wait_for_ip_address: true
delegate_to: localhost
# Deploys a new VM named 'NewVM' in specific datacenter/cluster, with network mapping taken from variable and using ova template from an absolute path
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: Datacenter1
cluster: Cluster1
datastore: vsandatastore
name: NewVM
networks: "{u'VM Network':u'{{ ProvisioningNetworkLabel }}'}"
power_on: false
ovf: /absolute/path/to/template/mytemplate.ova
delegate_to: localhost
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: Datacenter1
esxi_hostname: test-server
datastore: test-datastore
ovf: /path/to/ubuntu-16.04-amd64.ovf
delegate_to: localhost
- community.vmware.vmware_deploy_ovf:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
url: https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64.ova
wait_for_ip_address: true
delegate_to: localhost
返回值
常用返回值已在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
有关新虚拟机的元数据 返回:始终 示例: |