【发布时间】:2020-10-15 09:40:07
【问题描述】:
我尝试执行这个 ansible yml 文件来获取 vsphere 中的 vm 信息,
我有两个文件:
主机文件:
[Web]
192.168.11.11 #ip of my vsphere server
test.vmware2.yaml 文件:
- name: Gather all registered virtual machines
community.vmware.vmware_vm_info:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
register: vminfo
我用这个命令执行:
ansible -i /mnt/hosts test.vmware2.yaml
我有这条消息:
ERROR! 'community.vmware.vmware_vm_info' is not a valid attribute for a Play
The error appears to be in '/mnt/test.vmware2.yaml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Gather all registered virtual machines
^ here
我想知道是什么问题?
感谢您的回复
【问题讨论】:
-
也许你可以把你使用的ansible版本放在这里?
ansible --version -
这就是
test.vmware2.yaml中的全部内容吗? -
我有这个版本的 ansible ansible --version ansible 2.9.6 配置文件 = /etc/ansible/ansible.cfg 配置的模块搜索路径 = ['/home/gthuraisingam/.ansible/plugins/ modules', '/usr/share/ansible/plugins/modules'] ansible python 模块位置 = /usr/lib/python3/dist-packages/ansible 可执行位置 = /usr/bin/ansible python 版本 = 3.8.5(默认,2020 年 7 月 28 日,12:59:40) [GCC 9.3.0]
-
它就是我在文件 [test.vmware2.yaml] 中的全部内容
标签: python ansible virtual-machine vmware vsphere