0aa59ce9ab
In the VMware tests, we call the datastores `ds1` and `ds2`. The first one is read-only, the second is read-write and can be used to deploy VMs. The naming convention was not clear enough and source of a lot confusion and mistake. We now have two better names: - ro_datastore, which is ... read-only - rw_datastore, the one that we can use to deploy new VM.
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
# Test code for the vmware_guest_disk_disk module.
|
|
|
|
- import_role:
|
|
name: prepare_vmware_tests
|
|
vars:
|
|
setup_attach_host: true
|
|
setup_datastore: true
|
|
setup_virtualmachines: true
|
|
|
|
- name: create new disk with invalid disk mode
|
|
vmware_guest_disk:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
datacenter: "{{ dc1 }}"
|
|
validate_certs: no
|
|
name: "{{ virtual_machines[0].name }}"
|
|
disk:
|
|
- datastore: "{{ rw_datastore }}"
|
|
disk_mode: "invalid_disk_mode"
|
|
scsi_controller: 0
|
|
scsi_type: 'paravirtual'
|
|
size_gb: 10
|
|
state: present
|
|
type: eagerzeroedthick
|
|
unit_number: 2
|
|
register: test_create_disk1
|
|
ignore_errors: True
|
|
|
|
- debug:
|
|
msg: "{{ test_create_disk1 }}"
|
|
|
|
- name: assert that changes were not made
|
|
assert:
|
|
that:
|
|
- not(test_create_disk1 is changed)
|
|
|
|
- name: create new disk(s) with valid disk mode
|
|
vmware_guest_disk:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
datacenter: "{{ dc1 }}"
|
|
validate_certs: no
|
|
name: "{{ virtual_machines[0].name }}"
|
|
disk:
|
|
- datastore: "{{ rw_datastore }}"
|
|
disk_mode: "independent_persistent"
|
|
scsi_controller: 0
|
|
scsi_type: 'paravirtual'
|
|
size_gb: 1
|
|
state: present
|
|
type: eagerzeroedthick
|
|
unit_number: 2
|
|
- datastore: "{{ rw_datastore }}"
|
|
disk_mode: "independent_nonpersistent"
|
|
scsi_controller: 0
|
|
scsi_type: 'paravirtual'
|
|
size_gb: 1
|
|
state: present
|
|
type: eagerzeroedthick
|
|
unit_number: 3
|
|
- datastore: "{{ rw_datastore }}"
|
|
disk_mode: "persistent"
|
|
scsi_controller: 0
|
|
scsi_type: 'paravirtual'
|
|
size_gb: 1
|
|
state: present
|
|
type: eagerzeroedthick
|
|
unit_number: 4
|
|
register: test_create_disk2
|
|
|
|
- debug:
|
|
msg: "{{ test_create_disk2 }}"
|
|
|
|
- name: assert that changes were made
|
|
assert:
|
|
that:
|
|
- test_create_disk2 is changed
|