community.general.xenserver_guest_info module – Gathers information for virtual machines running on Citrix Hypervisor/XenServer host or pool
Note
This module is part of the community.general collection (version 9.5.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.xenserver_guest_info
.
Synopsis
This module can be used to gather essential VM facts.
Requirements
The below requirements are needed on the host that executes this module.
XenAPI
Parameters
Parameter |
Comments |
---|---|
The hostname or IP address of the XenServer host or XenServer pool master. If the value is not specified in the task, the value of environment variable Default: |
|
Name of the VM to gather facts from. VMs running on XenServer do not necessarily have unique names. The module will fail if multiple VMs with same name are found. In case of multiple VMs with same name, use This parameter is case sensitive. |
|
The password to use for connecting to XenServer. If the value is not specified in the task, the value of environment variable |
|
The username to use for connecting to XenServer. If the value is not specified in the task, the value of environment variable Default: |
|
UUID of the VM to gather fact of. This is XenServer’s unique identifier. It is required if name is not unique. |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Will return details on what has changed (or possibly needs changing in |
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: Gather facts
community.general.xenserver_guest_info:
hostname: "{{ xenserver_hostname }}"
username: "{{ xenserver_username }}"
password: "{{ xenserver_password }}"
name: testvm_11
delegate_to: localhost
register: facts
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Metadata about the VM Returned: always Sample: |