mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.8 KiB
YAML
74 lines
1.8 KiB
YAML
# 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: 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)
|