我是 ansible 的新手。我正在尝试从 esxi 获取有关其上安装的虚拟机的信息。没有可用的 vcenter。
我已经创建了剧本。连接正在工作,但是我在任务调试中收到错误。任何帮助深表感谢。谢谢
剧本:
- hosts: esxi
gather_facts: false
become: false
tasks:
- name: Gather all registered virtual machines
community.vmware.vmware_vm_info:
hostname: '{{ hostname }}'
username: '{{ ansible_user }}'
password: '{{ password }}'
validate_certs: no
delegate_to: localhost
register: vminfo
- debug:
msg: "{{ item.guest_name }}, {{ item.ip_address }}"
with_items:
- "{{ vminfo.virtual_machines }}"
Run Code Online (Sandbox Code Playgroud)
错误是:
TASK [debug] *************************************************************************************************************************
fatal: [192.168.233.202]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe …Run Code Online (Sandbox Code Playgroud)