ansible/test/integration/targets/prepare_vmware_tests/tasks/init_vcsim.yml
Gonéri Le Bouder 964783fbd2 vmware_guest: speed up vmware_guest tests
- Use predictable VM name during the tests (test_vm1, test_vm2 and
  test_vm2). This to simplify the teardown of the newly created resource
  before the next test.
- Update the documentation to explain the new requirement
- Avoid VM creation with `with_items` when it's not mandatory. This to:
    - speed up the test execution, our hypervisors have limited resources
    - simplify the teardown
- Remove `create_d1_c1_f0_env.yml`, the test was just testing how Ansible
  pass environment variables.
- Correct the name for the `f0` variable (`f1`)
- Fix the DVS tests, the hosts can now reach the dvswitch1 vswitch
- Provision the VM with a poweroff status, this to improve the
  idempotency and sleep up the tests
- Avoid the use of `prepare_vmware_tests` to prepare virtual machines
  when we just need one machine
2019-07-26 14:07:01 +02:00

48 lines
1.2 KiB
YAML

---
- name: load vars
include_vars:
file: vcsim.yml
- name: kill vcsim
uri:
url: http://{{ vcsim }}:5000/killall
- name: start vcsim (all dressed)
uri:
url: http://{{ vcsim }}:5000/spawn?cluster=1&folder=1&ds=2
register: vcsim_instance
when: setup_esxi_instance is not defined
- name: start vcsim (ESXi only)
uri:
url: http://{{ vcsim }}:5000/spawn?esx=1
register: vcsim_instance
when: setup_esxi_instance is defined
# - name: get a list of Hosts from vcsim
# uri:
# url: http://{{ vcsim }}:5000/govc_find?filter=H
# register: vcsim_host_list
# - name: get a list of Hosts from vcsim
# uri:
# url: http://{{ vcsim }}:5000/govc_find?filter=F
# register: vcsim_host_folder
# - debug: var=vcsim_host_folder
- set_fact:
vcenter_hostname: "{{ vcsim }}"
vcenter_username: "user"
vcenter_password: "pass"
- name: set state to poweroff on all VMs
vmware_guest:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ item.name }}"
state: poweredoff
with_items: "{{ virtual_machines + virtual_machines_in_cluster }}"
register: poweroff_d1_c1_f0