通过ESXi主机上的“可通过”部署虚拟机 [英] Deploy a VM via Ansible on ESXi Host
问题描述
我正在尝试通过ESXi主机上的可通过Ansible部署虚拟机。
他们都彼此认识(我复制了SSH ID文件,所以我们不需要输入密码)。
所以,我在ansible中使用了以下角色:
i am trying to deploy a VM via Ansible on an ESXi Host. They both know each other (i copied the SSH ID File, so we do not need to enter a password). so, i used the following role in ansible:
- vsphere_guest:
vcenter_hostname: emea-esx-s18t.mydomain.net
username: myuser
password: mypassword
guest: newvm001
state: powered_off
vm_extra_config:
vcpu.hotadd: yes
mem.hotadd: yes
notes: This is a test VM
vm_disk:
disk1:
size_gb: 10
type: thin
datastore: storage001
vm_nic:
nic1:
type: vmxnet3
network: VM Network
network_type: standard
vm_hardware:
memory_mb: 4096
num_cpus: 4
osid: windows7Server64Guest
scsi: paravirtual
esxi:
datacenter: MyDatacenter
hostname: esx-s18t.mydomain.net
所以当你使用这个角色,我得到以下输出:
So while u use this role, i get the following output:
root@ansible1:~/ansible# ansible-playbook -i Inventory vmware_deploy.yml
PLAY ***************************************************************************
TASK [setup] *******************************************************************
ok: [172.20.22.5]
PLAY RECAP *********************************************************************
172.20.22.5 : ok=1 changed=0 unreachable=0 failed=0
这是vmware_deploy.yml文件:
This is the vmware_deploy.yml file:
---
- hosts: vmware
remote_user: root
roles:
- vmware
ESXi主机是172.20.22.5!
The ESXi host is the 172.20.22.5 !
但是当我看看ESXi主机时,没有什么发生..我不知道为什么?他说可以,但没有改变或发生在这里?
你们可能知道这里有什么问题吗?
But when i take a look on the ESXi Host, nothing happend.. i dont know why? he said its okay but nothing changed or happend here? Do you guys maybe know whats wrong here?
PS:我需要使域,密码,用户和东西在这个例子中看起来不一样,那就是为什么被列为myuser,我的...,...
PS: I needed to make the domain, password, user and stuff looking different in this example thats why there is listed "myuser", "my...",...
推荐答案
确保您的 ./ roles / vmware / tasks / main.yml
到位。
这篇关于通过ESXi主机上的“可通过”部署虚拟机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!