0
這是我的Ansible劇本來創建一個新的VM。Ansible playbook無法啓動?
---
- name: Create a VM in OA resource pool
hosts: local
connection: local
gather_facts: False
tasks:
- name: create VM
vsphere_guest:
vcenter_hostname: https:\\virtualcenter
username: '{{ user }}'
password: '{{ password }}'
guest: '{{ guest }}'
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: thick
datastore: storage
vm_nic:
type: vmxnet3
network: network1
vm_hardware:
memory_mb: 1024
num_cpus: 1
osid: centos64Guest
scsi: paravirtual
resource_pool: "RP1"
變量從命令行傳遞。 然而,當我嘗試運行的任務,我得到這個:
No config file found; using defaults
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
PLAYBOOK: createvm.yml *********************************************************
1 plays in playbooks/vmware/createvm.yml
PLAY [Create a VM in OA resource pool] *****************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
的,可以是什麼原因呢?一個錯字?使用列表任務進行語法檢查也不會顯示任何內容。
謝謝,它的工作,當我改變本地localhost! –