VMware 和 Ansible - 资源池?
VMware and Ansible - Resource pools?
我目前正在尝试编写一个剧本来在我们的 VMware 集群中部署虚拟机,但我目前不知所措。无论向playbook输入什么,它都不会识别资源池。
---
- 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
不管我怎么定义资源池,总是returns报错。在官方文档中,资源池显示为已定义:
resource_pool: "/Resources"
其中 "/Resources"
,我假设是资源池,尽管这个不管有没有前斜杠都不起作用。
在 ServerFault 的一个问题中找到了我的解决方案。事实证明,您需要定义资源池的方式是使用 /Resources 作为一种目录。
因此,要将机器添加到名为 'TestVM' 的资源池中,您需要定义以下内容:
resource_pool: "/Resources/TestVM"
希望这可以帮助到我船上的任何人。
我目前正在尝试编写一个剧本来在我们的 VMware 集群中部署虚拟机,但我目前不知所措。无论向playbook输入什么,它都不会识别资源池。
---
- 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
不管我怎么定义资源池,总是returns报错。在官方文档中,资源池显示为已定义:
resource_pool: "/Resources"
其中 "/Resources"
,我假设是资源池,尽管这个不管有没有前斜杠都不起作用。
在 ServerFault 的一个问题中找到了我的解决方案。事实证明,您需要定义资源池的方式是使用 /Resources 作为一种目录。
因此,要将机器添加到名为 'TestVM' 的资源池中,您需要定义以下内容:
resource_pool: "/Resources/TestVM"
希望这可以帮助到我船上的任何人。