我目前正试图编写一本剧本,以便在我们的VMware集群中部署虚拟机,但我目前不知所措。无论游戏手册中输入了什么,它都不会识别资源库。
---
- hosts: all
gather_facts: false
connection: local
user: remote
sudo: false
vars_prompt
- name: "resource_pool"
prompt: "Enter resource pool"
private: no
vars:
notes: 'Created by Ansible'
vcenter_hostname: 'esxhost.local'
vcenter_username: 'om'
vcenter_password: '*********'
tasks:
- vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
guest: "{{ vm_name }}"
cluster: DummyCluster
resource_pool: "{{ resource_pool }}"
from_template: no
template_src: testvm001
vm_extra_config:
notes: "{{ notes }}"
vm_disk:
disk1:
size_gb: 10
type: thin
datastore: dummystore01
vm_nic:
nic1:
type: vmxnet3
network: vlan48-internal
network_type: standard
vm_hardware:
memory_mb: 512
num_cpus: 1
osid: ubuntu64Guest
scsi: paravirtual
esxi:
datacenter: DUMMY-DC
hostname: esxdummy01.local无论我如何定义资源池,它总是返回一个错误。在正式文件中,资源池被显示为定义如下:
resource_pool: "/Resources"在"/Resources"中,我假设是资源池,尽管无论是否使用前斜杠,都不能工作。
发布于 2016-01-07 14:23:39
在ServerFault上的一个问题中找到了我的解决方案。原来,您需要定义资源池的方式是使用/Resources作为一种目录。
因此,要将一台机器添加到名为“TestVM”的资源池中,需要定义以下内容:
resource_pool: "/Resources/TestVM"希望这对我船上的任何人都有帮助。
https://stackoverflow.com/questions/34636641
复制相似问题