diff options
author | Gonéri Le Bouder <goneri@lebouder.net> | 2019-05-16 09:36:48 -0400 |
---|---|---|
committer | Gonéri Le Bouder <goneri@lebouder.net> | 2019-05-23 17:40:19 -0400 |
commit | 6bb21c3db0bbaaa31aef09b6e5971e83a1f016df (patch) | |
tree | fdae4329d2d7ead8a0afdfb7059b93cf7bcecb7f /test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml | |
parent | 4adb7cfb5f5e04aca29c7fd95f52e48901629c86 (diff) | |
download | ansible-6bb21c3db0bbaaa31aef09b6e5971e83a1f016df.tar.gz |
vmware: test-refactoring
- In order to keep the integration with `ansible-test`, we prefer to avoid any
interaction with the Ansible inventory file.
- split up the prepare_vmware_tests/defaults/main.yml in two
configuration files: one for vcsim and one for a real environment
- remove all the access to hostvars
- directly interact with the ESXi to mount/umount the datastore
https://github.com/ansible/ansible/pull/56516
- record the virtual machine folder in the environment configuration
- vmware_guest_move: Use https://github.com/ansible/ansible/pull/55237
Diffstat (limited to 'test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml')
-rw-r--r-- | test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml b/test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml index 763701aa4d..dd76e42818 100644 --- a/test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml +++ b/test/integration/targets/prepare_vmware_tests/tasks/setup_virtualmachines.yml @@ -1,25 +1,41 @@ --- -- name: Create a VM folder on given Datacenter - vcenter_folder: - hostname: '{{ vcenter_hostname }}' - username: '{{ vcenter_username }}' - password: '{{ vcenter_password }}' - datacenter: '{{ dc1 }}' - folder_name: '{{ f0 }}' - folder_type: vm - state: present +- name: Create VMs + vmware_guest: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" validate_certs: no + folder: '{{ item.folder }}' + name: '{{ item.name }}' + state: poweredon + guest_id: debian8_64Guest + disk: + - size_gb: 1 + type: thin + datastore: '{{ ds2 }}' + hardware: + memory_mb: 128 + num_cpus: 1 + scsi: paravirtual + cdrom: + type: iso + iso_path: "[{{ ds1 }}] Fedora-Workstation-Live-x86_64-29-1.2.iso" + networks: + - name: VM Network + with_items: '{{ virtual_machines }}' -- name: Create VMs + +- name: Create VMs in cluster vmware_guest: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" datacenter: "{{ dc1 }}" validate_certs: no - folder: '{{ f0 }}' - cluster: '{{ ccr1 }}' - name: '{{ item }}' + folder: '{{ item.folder }}' + cluster: '{{ item.cluster }}' + name: '{{ item.name }}' state: poweredon guest_id: debian8_64Guest disk: @@ -35,4 +51,4 @@ iso_path: "[{{ ds1 }}] Fedora-Workstation-Live-x86_64-29-1.2.iso" networks: - name: VM Network - with_items: '{{ infra.vm_list }}' + with_items: '{{ virtual_machines_in_cluster }}' |