mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
VMware Module - vmware_guest_move (#42149)
This commit is contained in:
committed by
Abhijeet Kasurde
parent
f2c9a6b126
commit
711dd9f834
2
test/integration/targets/vmware_guest_move/aliases
Normal file
2
test/integration/targets/vmware_guest_move/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
shippable/vcenter/group1
|
||||
cloud/vcenter
|
||||
78
test/integration/targets/vmware_guest_move/tasks/main.yml
Normal file
78
test/integration/targets/vmware_guest_move/tasks/main.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
# Test code for the vmware_guest_move module
|
||||
# Copyright: (c) 2018, Jose Angel Munoz <josea.munoz@gmail.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: store the vcenter container ip
|
||||
set_fact:
|
||||
vcsim: "{{ lookup('env', 'vcenter_host') }}"
|
||||
- debug: var=vcsim
|
||||
|
||||
- name: Wait for Flask controller to come up online
|
||||
wait_for:
|
||||
host: "{{ vcsim }}"
|
||||
port: 5000
|
||||
state: started
|
||||
|
||||
- name: kill vcsim
|
||||
uri:
|
||||
url: http://{{ vcsim }}:5000/killall
|
||||
|
||||
- name: start vcsim
|
||||
uri:
|
||||
url: http://{{ vcsim }}:5000/spawn?folder=2&dc=2
|
||||
register: vcsim_instance
|
||||
|
||||
- name: Wait for Flask controller to come up online
|
||||
wait_for:
|
||||
host: "{{ vcsim }}"
|
||||
port: 443
|
||||
state: started
|
||||
|
||||
- debug: var=vcsim_instance
|
||||
|
||||
- name: get a list of virtual machines from vcsim
|
||||
uri:
|
||||
url: http://{{ vcsim }}:5000/govc_find?filter=VM
|
||||
register: vms
|
||||
|
||||
- set_fact: vm1="{{ vms['json'][0] }}"
|
||||
|
||||
# Testcase 0001: Move vm and get changed status
|
||||
- name: Move VM (Changed)
|
||||
vmware_guest_move:
|
||||
validate_certs: false
|
||||
hostname: "{{ vcsim }}"
|
||||
username: "{{ vcsim_instance['json']['username'] }}"
|
||||
password: "{{ vcsim_instance['json']['password'] }}"
|
||||
datacenter: "{{ (vm1|basename).split('_')[0] }}"
|
||||
name: "{{ vm1|basename }}"
|
||||
dest_folder: F1/DC1/vm/F1
|
||||
register: vm_facts_0001
|
||||
|
||||
|
||||
# Testcase 0002: Move vm and get OK status (Already Moved)
|
||||
- name: Move VM (OK)
|
||||
vmware_guest_move:
|
||||
validate_certs: false
|
||||
hostname: "{{ vcsim }}"
|
||||
username: "{{ vcsim_instance['json']['username'] }}"
|
||||
password: "{{ vcsim_instance['json']['password'] }}"
|
||||
datacenter: "{{ (vm1|basename).split('_')[0] }}"
|
||||
name: "{{ vm1|basename }}"
|
||||
dest_folder: F1/DC1/vm/F1
|
||||
register: vm_facts_0002
|
||||
|
||||
- debug:
|
||||
msg: "{{ vm_facts_0001 }}"
|
||||
|
||||
- debug:
|
||||
msg: "{{ vm_facts_0002 }}"
|
||||
|
||||
- name: get all VMs
|
||||
uri:
|
||||
url: http://{{ vcsim }}:5000/govc_find?filter=VM
|
||||
register: vms_diff
|
||||
|
||||
- name: Difference
|
||||
debug:
|
||||
var: vms_diff.json | difference(vms.json)
|
||||
Reference in New Issue
Block a user