mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Update vmware_guest_find module (#26066)
Fix updated following: * Update Documentation * Update Examples * Find VM's folder using VM's UUID * Make name as optional parameter Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
9f7fcf15be
commit
79b2897462
2 changed files with 56 additions and 17 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
- name: get a list of VMS from vcsim
|
||||
uri:
|
||||
url: "{{ 'http://' + vcsim + ':5000/govc_find?filter=_VM' }}"
|
||||
url: "{{ 'http://' + vcsim + ':5000/govc_find?filter=VM' }}"
|
||||
register: vmlist
|
||||
|
||||
- debug: var=vcsim_instance
|
||||
|
@ -54,3 +54,29 @@
|
|||
- "{{ 'folders' in item }}"
|
||||
- "{{ item['folders']|length == 1 }}"
|
||||
with_items: "{{ folders.results }}"
|
||||
|
||||
# Testcase 2: Find VMS using UUID
|
||||
- name: get details about VMS from vcsim
|
||||
uri:
|
||||
url: "{{ 'http://' + vcsim + ':5000/govc_vm_info' }}"
|
||||
register: vms_detail_list
|
||||
|
||||
- name: find folders for each vm using UUID
|
||||
vmware_guest_find:
|
||||
validate_certs: False
|
||||
hostname: "{{ vcsim }}"
|
||||
username: "{{ vcsim_instance['json']['username'] }}"
|
||||
password: "{{ vcsim_instance['json']['password'] }}"
|
||||
uuid: "{{ vms_detail_list['json'][item|basename]['UUID'] }}"
|
||||
datacenter: "{{ (item|basename).split('_')[0] }}"
|
||||
with_items: "{{ vmlist['json'] }}"
|
||||
register: folders_uuid
|
||||
|
||||
- debug: var=item
|
||||
with_items: "{{ folders_uuid.results }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "{{ 'folders' in item }}"
|
||||
- "{{ item['folders']|length == 1 }}"
|
||||
with_items: "{{ folders_uuid.results }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue