Skip to content

Commit

Permalink
Modified vcenter_vm_customize test to run on real vCebter (#577)
Browse files Browse the repository at this point in the history
Modified vcenter_vm_customize test to run on real vCenter

Reviewed-by: Shelly Miron
Reviewed-by: Polina Rabinovich
Reviewed-by: Anna Savina
  • Loading branch information
anna-savina authored Jan 2, 2025
1 parent 4a41c63 commit a1a027d
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 214 deletions.
17 changes: 17 additions & 0 deletions tests/integration/targets/action_on_vm/create_vm_from_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Create a generic resource pool
vmware.vmware_rest.vcenter_resourcepool:
name: "{{ resource_pool_name }}"
parent: "{{ lookup('vmware.vmware_rest.resource_pool_moid', '/' + vcenter_datacenter + '/' + vcenter_cluster_name + '/' + resource_pool_parent_name) }}"
register: resource_pool_info

- name: Deploy a new VM based on the template
vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
name: "{{ vm_name }}"
template_library_item: "{{ vcenter_test_vm_template.id }}"
placement:
cluster: "{{ lookup('vmware.vmware_rest.cluster_moid', '/' + vcenter_datacenter + '/' + vcenter_cluster_name) }}"
folder: "{{ lookup('vmware.vmware_rest.folder_moid', '/' + vcenter_datacenter + '/' + vcenter_vm_folder) }}"
resource_pool: "{{ resource_pool_info.id }}"
state: deploy
register: vm_from_template
20 changes: 20 additions & 0 deletions tests/integration/targets/action_on_vm/delete_vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Power off VM
vmware.vmware_rest.vcenter_vm_guest_power:
vm: "{{ vm_id }}"
state: shutdown

- name: Wait until VM is off
vmware.vmware_rest.vcenter_vm_info:
vm: "{{ vm_id }}"
register: vm_info
until:
- vm_info is not failed
- vm_info.value.power_state == "POWERED_OFF"
retries: 60
delay: 5

- name: Delete VM
vmware.vmware_rest.vcenter_vm:
vm: "{{ vm_id }}"
state: absent
1 change: 0 additions & 1 deletion tests/integration/targets/vcenter_vm_customize/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions tests/integration/targets/vcenter_vm_customize/aliases

This file was deleted.

Empty file.
10 changes: 0 additions & 10 deletions tests/integration/targets/vcenter_vm_customize/playbook.yml

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tests/integration/targets/vcenter_vm_customize/runme.sh

This file was deleted.

185 changes: 0 additions & 185 deletions tests/integration/targets/vcenter_vm_customize/tasks/main.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
test_resource_pool_name: "{{ tiny_prefix }}-vm-customize-resource-pool"
test_vm_name: "{{ tiny_prefix }}-vm"
new_vm_setting:
vm_ip: 10.46.29.150
dns_host_name: test
dns_servers: 1.1.1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: localhost
gather_facts: no

tasks:
- name: Import vcenter vm cusromize test
ansible.builtin.import_role:
name: vmware_rest_vcenter_vm_customize
tags:
- eco-vcenter-ci
Loading

0 comments on commit a1a027d

Please sign in to comment.