community / community.general / 2.5.9 / module / xenserver_guest_powerstate Manages power states of virtual machines running on Citrix Hypervisor/XenServer host or pool Authors: Bojan Vitnik (@bvitnik) <bvitnik@mainstream.rs>community.general.xenserver_guest_powerstate (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
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.
- 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
name: aliases: - name_label description: - Name of the VM to manage. - 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 C(uuid) to uniquely specify VM to manage. - This parameter is case sensitive. type: str uuid: description: - UUID of the VM to manage if known. This is XenServer's unique identifier. - It is required if name is not unique. type: str state: choices: - powered-on - powered-off - restarted - shutdown-guest - reboot-guest - suspended - present default: present description: - Specify the state VM should be in. - If C(state) is set to value other than C(present), then VM is transitioned into required state and facts are returned. - If C(state) is set to C(present), then VM is just checked for existence and facts are returned. type: str hostname: aliases: - host - pool default: localhost description: - 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 C(XENSERVER_HOST) will be used instead. type: str password: aliases: - pass - pwd description: - The password to use for connecting to XenServer. - If the value is not specified in the task, the value of environment variable C(XENSERVER_PASSWORD) will be used instead. type: str username: aliases: - admin - user default: root description: - The username to use for connecting to XenServer. - If the value is not specified in the task, the value of environment variable C(XENSERVER_USER) will be used instead. type: str validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable C(XENSERVER_VALIDATE_CERTS) will be used instead. type: bool wait_for_ip_address: default: false description: - Wait until XenServer detects an IP address for the VM. - This requires XenServer Tools to be preinstalled on the VM to work properly. type: bool state_change_timeout: default: 0 description: - 'By default, module will wait indefinitely for VM to change state or acquire an IP address if C(wait_for_ip_address: yes).' - If this parameter is set to positive value, the module will instead wait specified number of seconds for the state change. - In case of timeout, module will generate an error message. type: int
instance: description: Metadata about the VM returned: always sample: cdrom: type: none customization_agent: native disks: - name: windows-template-testing-0 name_desc: '' os_device: xvda size: 42949672960 sr: Local storage sr_uuid: 0af1245e-bdb0-ba33-1446-57a962ec4075 vbd_userdevice: '0' - name: windows-template-testing-1 name_desc: '' os_device: xvdb size: 42949672960 sr: Local storage sr_uuid: 0af1245e-bdb0-ba33-1446-57a962ec4075 vbd_userdevice: '1' domid: '56' folder: '' hardware: memory_mb: 8192 num_cpu_cores_per_socket: 2 num_cpus: 4 home_server: '' is_template: false name: windows-template-testing name_desc: '' networks: - gateway: 192.168.0.254 gateway6: fc00::fffe ip: 192.168.0.200 ip6: - fe80:0000:0000:0000:e9cb:625a:32c5:c291 - fc00:0000:0000:0000:0000:0000:0000:0001 mac: ba:91:3a:48:20:76 mtu: '1500' name: Pool-wide network associated with eth1 netmask: 255.255.255.128 prefix: '25' prefix6: '64' vif_device: '0' other_config: base_template_name: Windows Server 2016 (64-bit) import_task: OpaqueRef:e43eb71c-45d6-5351-09ff-96e4fb7d0fa5 install-methods: cdrom instant: 'true' mac_seed: f83e8d8a-cfdc-b105-b054-ef5cb416b77e platform: acpi: '1' apic: 'true' cores-per-socket: '2' device_id: '0002' hpet: 'true' nx: 'true' pae: 'true' timeoffset: '-25200' vga: std videoram: '8' viridian: 'true' viridian_reference_tsc: 'true' viridian_time_ref_count: 'true' state: poweredon uuid: e3c0b2d5-5f05-424e-479c-d3df8b3e7cda xenstore_data: vm-data: '' type: dict