ansible/test/integration/targets/vmware_guest_powerstate/tasks/main.yml
Gonéri Le Bouder 0aa59ce9ab vmware/test: use better name for datastores
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.
2019-11-14 16:55:05 -05:00

72 lines
1.8 KiB
YAML

# Test code for the vmware_guest_powerstate module.
# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
setup_datastore: true
- name: Create a VM with the state poweredoff
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
validate_certs: no
folder: '{{ f0 }}'
name: test_vm1
state: poweredoff
guest_id: debian8_64Guest
disk:
- size_gb: 1
type: thin
datastore: '{{ rw_datastore }}'
hardware:
memory_mb: 128
num_cpus: 1
scsi: paravirtual
cdrom:
type: iso
iso_path: "[{{ ro_datastore }}] fedora.iso"
networks:
- name: VM Network
- name: set state to poweroff the first VM
vmware_guest_powerstate:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: test_vm1
folder: '{{ f0 }}'
state: powered-off
register: poweroff_d1_c1_f0
- debug:
var: poweroff_d1_c1_f0
- name: make sure change was made
assert:
that:
- not (poweroff_d1_c1_f0 is changed)
- when: vcsim is not defined
block:
- name: Set a schedule task for first VM
vmware_guest_powerstate:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: test_vm1
folder: '{{ f0 }}'
scheduled_at: "10/10/2030 10:10"
state: powered-on
register: poweron_d1_c1_f0
- name: Check that task is schedule
assert:
that:
- poweron_d1_c1_f0 is changed