Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware_guest_facts: Add lookup based on Manage Object ID (MoID) #54531

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
2 participants
@wilmardo
Copy link
Contributor

wilmardo commented Mar 28, 2019

SUMMARY

Adds lookup based on Manage Object ID (moRef ID or moId) to vmware_guest_facts.
The moRef ID has been a unique identifier for years, see for example this good serie of @lamw about this:
https://www.virtuallyghetto.com/2017/07/uniquely-identifying-vms-in-vsphere-part-3-enhanced-linked-mode-cross-vc-vmotion.html

At Intermax all our tools are based on this identifier, I think we are not the only one with this 'problem'. This PR allows users to use this existing reference to gather the UUID or name/folder for future usage.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

vmware_guest_facts

ADDITIONAL INFORMATION

Example of the usage in one of our roles:

---
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Gather facts for VMWare guest with Manage Object ID
    vmware_guest_facts:
      hostname: "{{ vmware_vcenter_hostname }}"
      username: "{{ vmware_vcenter_username }}"
      password: "{{ vmware_vcenter_password }}"
      datacenter: "{{ vmware_vcenter_datacenter }}"
      validate_certs: "{{ vmware_vcenter_validate_certs }}"
      moid: vm-31352
    register: facts

  - name: Use this new information to gather info again
    vmware_guest_facts:
      hostname: "{{ vmware_vcenter_hostname }}"
      username: "{{ vmware_vcenter_username }}"
      password: "{{ vmware_vcenter_password }}"
      datacenter: "{{ vmware_vcenter_datacenter }}"
      validate_certs: "{{ vmware_vcenter_validate_certs }}"
      name: "{{ facts.instance.hw_name }}"
      folder: "{{ facts.instance.hw_folder }}"
@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 28, 2019

@wilmardo, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 28, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_facts.py:0:0: E309 version_added for new option (moid) should be '2.8'. Currently StrictVersion ('0.0')

click here for bot help

@wilmardo wilmardo changed the title vmware_guest_facts: Add lookup based on Manage Object ID vmware_guest_facts: Add lookup based on Manage Object ID (MoID) Apr 3, 2019

@ansibot ansibot added the stale_ci label Apr 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.