The vmware_guest_facts module

This module gathers information on already created VMs:

- name: Gather facts on the yet_another_example_vm vm  vmware_guest_facts:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    datacenter: "my-datacenter"    folder: "/vms"    name: "yet_another_example_vm"  delegate_to: localhost  register: facts

The previous example gathers lots of information on the machine we defined in the previous section and registers the information as a variable so that we can use it elsewhere in our playbook run.

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.