Skip to content

Commit 4eecf59

Browse files
committed
Replace vmware.vmware_rest.vcenter_vm
1 parent 2d1cdb9 commit 4eecf59

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

tests/integration/targets/prepare_vmware_tests/tasks/teardown_with_esxi.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,34 @@
77
validate_certs: false
88
schema: vsphere
99
properties:
10-
- _moId
10+
- name
1111
register: existing_vms
1212
until: existing_vms is not failed
1313

14+
- name: Debug existing VMs
15+
debug:
16+
var: existing_vms
17+
1418
- name: Turn off the VM
15-
vmware.vmware.vm_powerstate:
19+
community.vmware.vmware_guest:
1620
hostname: '{{ vcenter_hostname }}'
1721
username: '{{ vcenter_username }}'
1822
password: '{{ vcenter_password }}'
1923
validate_certs: false
2024
state: powered-off
21-
moid: '{{ item.moid }}'
25+
name: '{{ item.name }}'
2226
with_items: "{{ existing_vms.guests }}"
2327
ignore_errors: true
2428

2529
- name: Delete the VMs
26-
vmware.vmware_rest.vcenter_vm:
27-
vcenter_hostname: '{{ vcenter_hostname }}'
28-
vcenter_username: '{{ vcenter_username }}'
29-
vcenter_password: '{{ vcenter_password }}'
30-
vcenter_validate_certs: false
30+
community.vmware.vmware_guest:
31+
hostname: '{{ vcenter_hostname }}'
32+
username: '{{ vcenter_username }}'
33+
password: '{{ vcenter_password }}'
34+
validate_certs: false
3135
state: absent
32-
vm: '{{ item.vm }}'
33-
with_items: "{{ existing_vms.value }}"
36+
name: '{{ item.name }}'
37+
with_items: "{{ existing_vms.guests }}"
3438
when:
3539
- not item.name.startswith("vCLS")
3640

tests/integration/targets/vmware_guest/tasks/run_test_playbook.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@
1010
schema: vsphere
1111
properties:
1212
- _moId
13+
- name
1314
register: existing_vms
1415
until: existing_vms is not failed
16+
17+
- name: Debug existing VMs
18+
debug:
19+
var: existing_vms
20+
1521
- name: Turn off the VM
16-
vmware.vmware.vm_powerstate:
22+
community.vmware.vmware_guest:
1723
hostname: '{{ vcenter_hostname }}'
1824
username: '{{ vcenter_username }}'
1925
password: '{{ vcenter_password }}'
2026
validate_certs: false
2127
state: powered-off
22-
moid: '{{ item.moid }}'
28+
name: '{{ item.name }}'
2329
with_items: "{{ existing_vms.guests }}"
2430
ignore_errors: true
2531
- name: Clean up VM
26-
vmware.vmware_rest.vcenter_vm:
27-
vcenter_hostname: '{{ vcenter_hostname }}'
28-
vcenter_username: '{{ vcenter_username }}'
29-
vcenter_password: '{{ vcenter_password }}'
30-
vcenter_validate_certs: false
32+
community.vmware.vmware_guest:
33+
hostname: '{{ vcenter_hostname }}'
34+
username: '{{ vcenter_username }}'
35+
password: '{{ vcenter_password }}'
36+
validate_certs: false
3137
state: absent
32-
vm: '{{ item.vm }}'
33-
with_items: "{{ existing_vms.value }}"
38+
name: '{{ item.name }}'
39+
with_items: "{{ existing_vms.guests }}"
3440
when:
3541
- not item.name.startswith("vCLS")

0 commit comments

Comments
 (0)