community.general.xenserver_guest_powerstate – Manages power states of virtual machines running on Citrix Hypervisor/XenServer host or pool¶
Note
This plugin is part of the community.general collection (version 1.3.6).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.xenserver_guest_powerstate
.
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/XenAPI.pyIf 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
community.general.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:
Authors¶
Bojan Vitnik (@bvitnik) <bvitnik@mainstream.rs>