xenserver_guest_powerstate – Manages power states of virtual machines running on Citrix Hypervisor/XenServer host or pool¶
New in version 2.8.
Synopsis¶
- This module can be used to power on, power off, restart or suspend virtual machine and gracefully reboot or shutdown guest OS of virtual machine.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.6
- XenAPI
Parameters¶
Notes¶
Note
- Minimal supported version of XenServer is 5.6.
- Module was tested with XenServer 6.5, 7.1, 7.2, 7.6, Citrix Hypervisor 8.0, XCP-ng 7.6 and 8.0.
- To acquire XenAPI Python library, just run
pip install XenAPI
on your Ansible Control Node. The library can also be found inside Citrix Hypervisor/XenServer SDK (downloadable from Citrix website). Copy the XenAPI.py file from the SDK to your Python site-packages on your Ansible Control Node to use it. Latest version of the library can also be acquired from GitHub: https://raw.githubusercontent.com/xapi-project/xen-api/master/scripts/examples/python/XenAPI.py - If no scheme is specified in
hostname
, module defaults tohttp://
becausehttps://
is problematic in most setups. Make sure you are accessing XenServer host in trusted environment or usehttps://
scheme explicitly. - To use
https://
scheme forhostname
you have to either import host certificate to your OS certificate store or usevalidate_certs: no
which requires XenAPI library from XenServer 7.2 SDK or newer and Python 2.7.9 or newer.
Examples¶
- name: Power on VM
xenserver_guest_powerstate:
hostname: "{{ xenserver_hostname }}"
username: "{{ xenserver_username }}"
password: "{{ xenserver_password }}"
name: testvm_11
state: powered-on
delegate_to: localhost
register: facts
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Bojan Vitnik (@bvitnik) <bvitnik@mainstream.rs>
Hint
If you notice any issues in this documentation, you can edit this document to improve it.