2018-05-12 17:39:53 +02:00
|
|
|
# Test code for the vmware_host_powerstate module.
|
|
|
|
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
# TODO: vcsim does not support Powerstate related to operations
|
2019-05-02 15:28:17 +02:00
|
|
|
- when: False
|
|
|
|
block:
|
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
|
|
|
vars:
|
|
|
|
setup_attach_host: true
|
|
|
|
|
|
|
|
|
|
|
|
# https://kb.vmware.com/s/article/2001651?lang=en_US
|
|
|
|
# It seems like we need a Power managment interface to be able to run the
|
|
|
|
# module.
|
|
|
|
# I currently get:
|
|
|
|
# "Failed to power down '192.168.123.7' to standby as host system due to : ('The operation is not supported on the object.', None)"
|
|
|
|
- name: Restart Host
|
|
|
|
vmware_host_powerstate:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: False
|
|
|
|
state: power-down-to-standby
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ esxi1 }}'
|
2019-05-02 15:28:17 +02:00
|
|
|
force: True
|
|
|
|
register: host_powerstate
|
|
|
|
|
|
|
|
- debug: var=host_powerstate
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- host_powerstate.results is changed
|