|
|
@ -1,345 +1,374 @@
|
|
|
|
#!/usr/bin/python
|
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
|
|
|
# Copyright (c) 2016 Red Hat, Inc.
|
|
|
|
# Copyright: (c) 2017, Ansible Project
|
|
|
|
#
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# This file is part of Ansible
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
'status': ['preview'],
|
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: ovirt_vms
|
|
|
|
module: ovirt_vms
|
|
|
|
short_description: "Module to manage Virtual Machines in oVirt/RHV"
|
|
|
|
short_description: Module to manage Virtual Machines in oVirt/RHV
|
|
|
|
version_added: "2.2"
|
|
|
|
version_added: "2.2"
|
|
|
|
author: "Ondra Machacek (@machacekondra)"
|
|
|
|
author:
|
|
|
|
|
|
|
|
- Ondra Machacek (@machacekondra)
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "This module manages whole lifecycle of the Virtual Machine(VM) in oVirt/RHV. Since VM can hold many states in oVirt/RHV,
|
|
|
|
- This module manages whole lifecycle of the Virtual Machine(VM) in oVirt/RHV.
|
|
|
|
this see notes to see how the states of the VM are handled."
|
|
|
|
- Since VM can hold many states in oVirt/RHV, this see notes to see how the states of the VM are handled.
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
name:
|
|
|
|
name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of the Virtual Machine to manage. If VM don't exists C(name) is required.
|
|
|
|
- Name of the Virtual Machine to manage.
|
|
|
|
Otherwise C(id) or C(name) can be used."
|
|
|
|
- If VM don't exists C(name) is required. Otherwise C(id) or C(name) can be used.
|
|
|
|
id:
|
|
|
|
id:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "ID of the Virtual Machine to manage."
|
|
|
|
- ID of the Virtual Machine to manage.
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Should the Virtual Machine be running/stopped/present/absent/suspended/next_run/registered.
|
|
|
|
- Should the Virtual Machine be running/stopped/present/absent/suspended/next_run/registered.
|
|
|
|
When C(state) is I(registered) and the unregistered VM's name
|
|
|
|
When C(state) is I(registered) and the unregistered VM's name
|
|
|
|
belongs to an already registered in engine VM in the same DC
|
|
|
|
belongs to an already registered in engine VM in the same DC
|
|
|
|
then we fail to register the unregistered template."
|
|
|
|
then we fail to register the unregistered template.
|
|
|
|
- "I(present) state will create/update VM and don't change its state if it already exists."
|
|
|
|
- I(present) state will create/update VM and don't change its state if it already exists.
|
|
|
|
- "I(running) state will create/update VM and start it."
|
|
|
|
- I(running) state will create/update VM and start it.
|
|
|
|
- "I(next_run) state updates the VM and if the VM has next run configuration it will be rebooted."
|
|
|
|
- I(next_run) state updates the VM and if the VM has next run configuration it will be rebooted.
|
|
|
|
- "Please check I(notes) to more detailed description of states."
|
|
|
|
- Please check I(notes) to more detailed description of states.
|
|
|
|
- "I(registered) is supported since 2.4"
|
|
|
|
- I(registered) is supported since 2.4.
|
|
|
|
choices: ['running', 'stopped', 'present', 'absent', 'suspended', 'next_run', 'registered']
|
|
|
|
choices: [ absent, next_run, present, registered, running, stopped, suspended ]
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
cluster:
|
|
|
|
cluster:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of the cluster, where Virtual Machine should be created. Required if creating VM."
|
|
|
|
- Name of the cluster, where Virtual Machine should be created.
|
|
|
|
|
|
|
|
- Required if creating VM.
|
|
|
|
allow_partial_import:
|
|
|
|
allow_partial_import:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Boolean indication whether to allow partial registration of Virtual Machine when C(state) is registered."
|
|
|
|
- Boolean indication whether to allow partial registration of Virtual Machine when C(state) is registered.
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
template:
|
|
|
|
template:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of the template, which should be used to create Virtual Machine. Required if creating VM."
|
|
|
|
- Name of the template, which should be used to create Virtual Machine.
|
|
|
|
- "If template is not specified and VM doesn't exist, VM will be created from I(Blank) template."
|
|
|
|
- Required if creating VM.
|
|
|
|
|
|
|
|
- If template is not specified and VM doesn't exist, VM will be created from I(Blank) template.
|
|
|
|
template_version:
|
|
|
|
template_version:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Version number of the template to be used for VM."
|
|
|
|
- Version number of the template to be used for VM.
|
|
|
|
- "By default the latest available version of the template is used."
|
|
|
|
- By default the latest available version of the template is used.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
use_latest_template_version:
|
|
|
|
use_latest_template_version:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Specify if latest template version should be used, when running a stateless VM."
|
|
|
|
- Specify if latest template version should be used, when running a stateless VM.
|
|
|
|
- "If this parameter is set to I(true) stateless VM is created."
|
|
|
|
- If this parameter is set to I(yes) stateless VM is created.
|
|
|
|
|
|
|
|
type: bool
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
storage_domain:
|
|
|
|
storage_domain:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of the storage domain where all template disks should be created."
|
|
|
|
- Name of the storage domain where all template disks should be created.
|
|
|
|
- "This parameter is considered only when C(template) is provided."
|
|
|
|
- This parameter is considered only when C(template) is provided.
|
|
|
|
- "C(**IMPORTANT**)"
|
|
|
|
- IMPORTANT - This parameter is not idempotent, if the VM exists and you specfiy different storage domain,
|
|
|
|
- "This parameter is not idempotent, if the VM exists and you specfiy different storage domain,
|
|
|
|
disk won't move.
|
|
|
|
disk won't move."
|
|
|
|
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
disk_format:
|
|
|
|
disk_format:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Specify format of the disk."
|
|
|
|
- Specify format of the disk.
|
|
|
|
- "If (cow) format is used, disk will by created as sparse, so space will be allocated for the volume as needed, also known as I(thin provision)."
|
|
|
|
- If C(cow) format is used, disk will by created as sparse, so space will be allocated for the volume as needed, also known as I(thin provision).
|
|
|
|
- "If (raw) format is used, disk storage will be allocated right away, also known as I(preallocated)."
|
|
|
|
- If C(raw) format is used, disk storage will be allocated right away, also known as I(preallocated).
|
|
|
|
- "Note that this option isn't idempotent as it's not currently possible to change format of the disk via API."
|
|
|
|
- Note that this option isn't idempotent as it's not currently possible to change format of the disk via API.
|
|
|
|
- "This parameter is considered only when C(template) and C(storage domain) is provided."
|
|
|
|
- This parameter is considered only when C(template) and C(storage domain) is provided.
|
|
|
|
choices: ['cow', 'raw']
|
|
|
|
choices: [ cow, raw ]
|
|
|
|
default: cow
|
|
|
|
default: cow
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
memory:
|
|
|
|
memory:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Amount of memory of the Virtual Machine. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB)."
|
|
|
|
- Amount of memory of the Virtual Machine. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB).
|
|
|
|
- "Default value is set by engine."
|
|
|
|
- Default value is set by engine.
|
|
|
|
memory_guaranteed:
|
|
|
|
memory_guaranteed:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Amount of minimal guaranteed memory of the Virtual Machine.
|
|
|
|
- Amount of minimal guaranteed memory of the Virtual Machine.
|
|
|
|
Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB)."
|
|
|
|
Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB).
|
|
|
|
- "C(memory_guaranteed) parameter can't be lower than C(memory) parameter. Default value is set by engine."
|
|
|
|
- C(memory_guaranteed) parameter can't be lower than C(memory) parameter.
|
|
|
|
|
|
|
|
- Default value is set by engine.
|
|
|
|
cpu_shares:
|
|
|
|
cpu_shares:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Set a CPU shares for this Virtual Machine. Default value is set by oVirt/RHV engine."
|
|
|
|
- Set a CPU shares for this Virtual Machine.
|
|
|
|
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
cpu_cores:
|
|
|
|
cpu_cores:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Number of virtual CPUs cores of the Virtual Machine. Default value is set by oVirt/RHV engine."
|
|
|
|
- Number of virtual CPUs cores of the Virtual Machine.
|
|
|
|
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
cpu_sockets:
|
|
|
|
cpu_sockets:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Number of virtual CPUs sockets of the Virtual Machine. Default value is set by oVirt/RHV engine."
|
|
|
|
- Number of virtual CPUs sockets of the Virtual Machine.
|
|
|
|
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
type:
|
|
|
|
type:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Type of the Virtual Machine. Default value is set by oVirt/RHV engine."
|
|
|
|
- Type of the Virtual Machine.
|
|
|
|
choices: [server, desktop]
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
|
|
|
|
choices: [ desktop, server ]
|
|
|
|
operating_system:
|
|
|
|
operating_system:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Operating system of the Virtual Machine. Default value is set by oVirt/RHV engine."
|
|
|
|
- Operating system of the Virtual Machine.
|
|
|
|
choices: [
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
rhel_6_ppc64, other, freebsd, windows_2003x64, windows_10, rhel_6x64, rhel_4x64, windows_2008x64,
|
|
|
|
choices:
|
|
|
|
windows_2008R2x64, debian_7, windows_2012x64, ubuntu_14_04, ubuntu_12_04, ubuntu_13_10, windows_8x64,
|
|
|
|
- debian_7
|
|
|
|
other_linux_ppc64, windows_2003, other_linux, windows_10x64, windows_2008, rhel_3, rhel_5, rhel_4,
|
|
|
|
- freebsd
|
|
|
|
other_ppc64, sles_11, rhel_6, windows_xp, rhel_7x64, freebsdx64, rhel_7_ppc64, windows_7, rhel_5x64,
|
|
|
|
- freebsdx64
|
|
|
|
ubuntu_14_04_ppc64, sles_11_ppc64, windows_8, windows_2012R2x64, windows_2008r2x64, ubuntu_13_04,
|
|
|
|
- other
|
|
|
|
ubuntu_12_10, windows_7x64
|
|
|
|
- other_linux
|
|
|
|
]
|
|
|
|
- other_linux_ppc64
|
|
|
|
|
|
|
|
- other_ppc64
|
|
|
|
|
|
|
|
- rhel_3
|
|
|
|
|
|
|
|
- rhel_4
|
|
|
|
|
|
|
|
- rhel_4x64
|
|
|
|
|
|
|
|
- rhel_5
|
|
|
|
|
|
|
|
- rhel_5x64
|
|
|
|
|
|
|
|
- rhel_6
|
|
|
|
|
|
|
|
- rhel_6x64
|
|
|
|
|
|
|
|
- rhel_6_ppc64
|
|
|
|
|
|
|
|
- rhel_7x64
|
|
|
|
|
|
|
|
- rhel_7_ppc64
|
|
|
|
|
|
|
|
- sles_11
|
|
|
|
|
|
|
|
- sles_11_ppc64
|
|
|
|
|
|
|
|
- ubuntu_12_04
|
|
|
|
|
|
|
|
- ubuntu_12_10
|
|
|
|
|
|
|
|
- ubuntu_13_04
|
|
|
|
|
|
|
|
- ubuntu_13_10
|
|
|
|
|
|
|
|
- ubuntu_14_04
|
|
|
|
|
|
|
|
- ubuntu_14_04_ppc64
|
|
|
|
|
|
|
|
- windows_10
|
|
|
|
|
|
|
|
- windows_10x64
|
|
|
|
|
|
|
|
- windows_2003
|
|
|
|
|
|
|
|
- windows_2003x64
|
|
|
|
|
|
|
|
- windows_2008
|
|
|
|
|
|
|
|
- windows_2008x64
|
|
|
|
|
|
|
|
- windows_2008r2x64
|
|
|
|
|
|
|
|
- windows_2008R2x64
|
|
|
|
|
|
|
|
- windows_2012x64
|
|
|
|
|
|
|
|
- windows_2012R2x64
|
|
|
|
|
|
|
|
- windows_7
|
|
|
|
|
|
|
|
- windows_7x64
|
|
|
|
|
|
|
|
- windows_8
|
|
|
|
|
|
|
|
- windows_8x64
|
|
|
|
|
|
|
|
- windows_xp
|
|
|
|
boot_devices:
|
|
|
|
boot_devices:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "List of boot devices which should be used to boot. Choices I(network), I(hd) and I(cdrom)."
|
|
|
|
- List of boot devices which should be used to boot. For example C([ cdrom, hd ]).
|
|
|
|
- "For example: ['cdrom', 'hd']. Default value is set by oVirt/RHV engine."
|
|
|
|
- Default value is set by oVirt/RHV engine.
|
|
|
|
|
|
|
|
choices: [ cdrom, hd, network ]
|
|
|
|
host:
|
|
|
|
host:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Specify host where Virtual Machine should be running. By default the host is chosen by engine scheduler."
|
|
|
|
- Specify host where Virtual Machine should be running. By default the host is chosen by engine scheduler.
|
|
|
|
- "This parameter is used only when C(state) is I(running) or I(present)."
|
|
|
|
- This parameter is used only when C(state) is I(running) or I(present).
|
|
|
|
high_availability:
|
|
|
|
high_availability:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "If I(True) Virtual Machine will be set as highly available."
|
|
|
|
- If I(yes) Virtual Machine will be set as highly available.
|
|
|
|
- "If I(False) Virtual Machine won't be set as highly available."
|
|
|
|
- If I(no) Virtual Machine won't be set as highly available.
|
|
|
|
- "If no value is passed, default value is set by oVirt/RHV engine."
|
|
|
|
- If no value is passed, default value is set by oVirt/RHV engine.
|
|
|
|
|
|
|
|
type: bool
|
|
|
|
lease:
|
|
|
|
lease:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of the storage domain this virtual machine lease reside on."
|
|
|
|
- Name of the storage domain this virtual machine lease reside on.
|
|
|
|
- "C(Note): Supported since oVirt 4.1."
|
|
|
|
- NOTE - Supported since oVirt 4.1.
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
delete_protected:
|
|
|
|
delete_protected:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "If I(True) Virtual Machine will be set as delete protected."
|
|
|
|
- If I(yes) Virtual Machine will be set as delete protected.
|
|
|
|
- "If I(False) Virtual Machine won't be set as delete protected."
|
|
|
|
- If I(no) Virtual Machine won't be set as delete protected.
|
|
|
|
- "If no value is passed, default value is set by oVirt/RHV engine."
|
|
|
|
- If no value is passed, default value is set by oVirt/RHV engine.
|
|
|
|
stateless:
|
|
|
|
stateless:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "If I(True) Virtual Machine will be set as stateless."
|
|
|
|
- If I(yes) Virtual Machine will be set as stateless.
|
|
|
|
- "If I(False) Virtual Machine will be unset as stateless."
|
|
|
|
- If I(no) Virtual Machine will be unset as stateless.
|
|
|
|
- "If no value is passed, default value is set by oVirt/RHV engine."
|
|
|
|
- If no value is passed, default value is set by oVirt/RHV engine.
|
|
|
|
clone:
|
|
|
|
clone:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "If I(True) then the disks of the created virtual machine will be cloned and independent of the template."
|
|
|
|
- If I(yes) then the disks of the created virtual machine will be cloned and independent of the template.
|
|
|
|
- "This parameter is used only when C(state) is I(running) or I(present) and VM didn't exist before."
|
|
|
|
- This parameter is used only when C(state) is I(running) or I(present) and VM didn't exist before.
|
|
|
|
default: False
|
|
|
|
type: bool
|
|
|
|
|
|
|
|
default: 'no'
|
|
|
|
clone_permissions:
|
|
|
|
clone_permissions:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "If I(True) then the permissions of the template (only the direct ones, not the inherited ones)
|
|
|
|
- If I(yes) then the permissions of the template (only the direct ones, not the inherited ones)
|
|
|
|
will be copied to the created virtual machine."
|
|
|
|
will be copied to the created virtual machine.
|
|
|
|
- "This parameter is used only when C(state) is I(running) or I(present) and VM didn't exist before."
|
|
|
|
- This parameter is used only when C(state) is I(running) or I(present) and VM didn't exist before.
|
|
|
|
default: False
|
|
|
|
type: bool
|
|
|
|
|
|
|
|
default: 'no'
|
|
|
|
cd_iso:
|
|
|
|
cd_iso:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "ISO file from ISO storage domain which should be attached to Virtual Machine."
|
|
|
|
- ISO file from ISO storage domain which should be attached to Virtual Machine.
|
|
|
|
- "If you pass empty string the CD will be ejected from VM."
|
|
|
|
- If you pass empty string the CD will be ejected from VM.
|
|
|
|
- "If used with C(state) I(running) or I(present) and VM is running the CD will be attached to VM."
|
|
|
|
- If used with C(state) I(running) or I(present) and VM is running the CD will be attached to VM.
|
|
|
|
- "If used with C(state) I(running) or I(present) and VM is down the CD will be attached to VM persistently."
|
|
|
|
- If used with C(state) I(running) or I(present) and VM is down the CD will be attached to VM persistently.
|
|
|
|
force:
|
|
|
|
force:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Please check to I(Synopsis) to more detailed description of force parameter, it can behave differently
|
|
|
|
- Please check to I(Synopsis) to more detailed description of force parameter, it can behave differently
|
|
|
|
in different situations."
|
|
|
|
in different situations.
|
|
|
|
default: False
|
|
|
|
type: bool
|
|
|
|
|
|
|
|
default: 'no'
|
|
|
|
nics:
|
|
|
|
nics:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "List of NICs, which should be attached to Virtual Machine. NIC is described by following dictionary:"
|
|
|
|
- List of NICs, which should be attached to Virtual Machine. NIC is described by following dictionary.
|
|
|
|
- "C(name) - Name of the NIC."
|
|
|
|
- C(name) - Name of the NIC.
|
|
|
|
- "C(profile_name) - Profile name where NIC should be attached."
|
|
|
|
- C(profile_name) - Profile name where NIC should be attached.
|
|
|
|
- "C(interface) - Type of the network interface. One of following: I(virtio), I(e1000), I(rtl8139), default is I(virtio)."
|
|
|
|
- C(interface) - Type of the network interface. One of following I(virtio), I(e1000), I(rtl8139), default is I(virtio).
|
|
|
|
- "C(mac_address) - Custom MAC address of the network interface, by default it's obtained from MAC pool."
|
|
|
|
- C(mac_address) - Custom MAC address of the network interface, by default it's obtained from MAC pool.
|
|
|
|
- "C(Note:)"
|
|
|
|
- NOTE - This parameter is used only when C(state) is I(running) or I(present) and is able to only create NICs.
|
|
|
|
- "This parameter is used only when C(state) is I(running) or I(present) and is able to only create NICs.
|
|
|
|
To manage NICs of the VM in more depth please use M(ovirt_nics) module instead.
|
|
|
|
To manage NICs of the VM in more depth please use M(ovirt_nics) module instead."
|
|
|
|
|
|
|
|
disks:
|
|
|
|
disks:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "List of disks, which should be attached to Virtual Machine. Disk is described by following dictionary:"
|
|
|
|
- List of disks, which should be attached to Virtual Machine. Disk is described by following dictionary.
|
|
|
|
- "C(name) - Name of the disk. Either C(name) or C(id) is reuqired."
|
|
|
|
- C(name) - Name of the disk. Either C(name) or C(id) is reuqired.
|
|
|
|
- "C(id) - ID of the disk. Either C(name) or C(id) is reuqired."
|
|
|
|
- C(id) - ID of the disk. Either C(name) or C(id) is reuqired.
|
|
|
|
- "C(interface) - Interface of the disk, either I(virtio) or I(IDE), default is I(virtio)."
|
|
|
|
- C(interface) - Interface of the disk, either I(virtio) or I(IDE), default is I(virtio).
|
|
|
|
- "C(bootable) - I(True) if the disk should be bootable, default is non bootable."
|
|
|
|
- C(bootable) - I(True) if the disk should be bootable, default is non bootable.
|
|
|
|
- "C(activate) - I(True) if the disk should be activated, default is activated."
|
|
|
|
- C(activate) - I(True) if the disk should be activated, default is activated.
|
|
|
|
- "C(Note:)"
|
|
|
|
- NOTE - This parameter is used only when C(state) is I(running) or I(present) and is able to only attach disks.
|
|
|
|
- "This parameter is used only when C(state) is I(running) or I(present) and is able to only attach disks.
|
|
|
|
To manage disks of the VM in more depth please use M(ovirt_disks) module instead.
|
|
|
|
To manage disks of the VM in more depth please use M(ovirt_disks) module instead."
|
|
|
|
|
|
|
|
sysprep:
|
|
|
|
sysprep:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Dictionary with values for Windows Virtual Machine initialization using sysprep:"
|
|
|
|
- Dictionary with values for Windows Virtual Machine initialization using sysprep.
|
|
|
|
- "C(host_name) - Hostname to be set to Virtual Machine when deployed."
|
|
|
|
- C(host_name) - Hostname to be set to Virtual Machine when deployed.
|
|
|
|
- "C(active_directory_ou) - Active Directory Organizational Unit, to be used for login of user."
|
|
|
|
- C(active_directory_ou) - Active Directory Organizational Unit, to be used for login of user.
|
|
|
|
- "C(org_name) - Organization name to be set to Windows Virtual Machine."
|
|
|
|
- C(org_name) - Organization name to be set to Windows Virtual Machine.
|
|
|
|
- "C(domain) - Domain to be set to Windows Virtual Machine."
|
|
|
|
- C(domain) - Domain to be set to Windows Virtual Machine.
|
|
|
|
- "C(timezone) - Timezone to be set to Windows Virtual Machine."
|
|
|
|
- C(timezone) - Timezone to be set to Windows Virtual Machine.
|
|
|
|
- "C(ui_language) - UI language of the Windows Virtual Machine."
|
|
|
|
- C(ui_language) - UI language of the Windows Virtual Machine.
|
|
|
|
- "C(system_locale) - System localization of the Windows Virtual Machine."
|
|
|
|
- C(system_locale) - System localization of the Windows Virtual Machine.
|
|
|
|
- "C(input_locale) - Input localization of the Windows Virtual Machine."
|
|
|
|
- C(input_locale) - Input localization of the Windows Virtual Machine.
|
|
|
|
- "C(windows_license_key) - License key to be set to Windows Virtual Machine."
|
|
|
|
- C(windows_license_key) - License key to be set to Windows Virtual Machine.
|
|
|
|
- "C(user_name) - Username to be used for set password to Windows Virtual Machine."
|
|
|
|
- C(user_name) - Username to be used for set password to Windows Virtual Machine.
|
|
|
|
- "C(root_password) - Password to be set for username to Windows Virtual Machine."
|
|
|
|
- C(root_password) - Password to be set for username to Windows Virtual Machine.
|
|
|
|
cloud_init:
|
|
|
|
cloud_init:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Dictionary with values for Unix-like Virtual Machine initialization using cloud init:"
|
|
|
|
- Dictionary with values for Unix-like Virtual Machine initialization using cloud init.
|
|
|
|
- "C(host_name) - Hostname to be set to Virtual Machine when deployed."
|
|
|
|
- C(host_name) - Hostname to be set to Virtual Machine when deployed.
|
|
|
|
- "C(timezone) - Timezone to be set to Virtual Machine when deployed."
|
|
|
|
- C(timezone) - Timezone to be set to Virtual Machine when deployed.
|
|
|
|
- "C(user_name) - Username to be used to set password to Virtual Machine when deployed."
|
|
|
|
- C(user_name) - Username to be used to set password to Virtual Machine when deployed.
|
|
|
|
- "C(root_password) - Password to be set for user specified by C(user_name) parameter."
|
|
|
|
- C(root_password) - Password to be set for user specified by C(user_name) parameter.
|
|
|
|
- "C(authorized_ssh_keys) - Use this SSH keys to login to Virtual Machine."
|
|
|
|
- C(authorized_ssh_keys) - Use this SSH keys to login to Virtual Machine.
|
|
|
|
- "C(regenerate_ssh_keys) - If I(True) SSH keys will be regenerated on Virtual Machine."
|
|
|
|
- C(regenerate_ssh_keys) - If I(True) SSH keys will be regenerated on Virtual Machine.
|
|
|
|
- "C(custom_script) - Cloud-init script which will be executed on Virtual Machine when deployed."
|
|
|
|
- C(custom_script) - Cloud-init script which will be executed on Virtual Machine when deployed.
|
|
|
|
- "C(dns_servers) - DNS servers to be configured on Virtual Machine."
|
|
|
|
- C(dns_servers) - DNS servers to be configured on Virtual Machine.
|
|
|
|
- "C(dns_search) - DNS search domains to be configured on Virtual Machine."
|
|
|
|
- C(dns_search) - DNS search domains to be configured on Virtual Machine.
|
|
|
|
- "C(nic_boot_protocol) - Set boot protocol of the network interface of Virtual Machine. Can be one of none, dhcp or static."
|
|
|
|
- C(nic_boot_protocol) - Set boot protocol of the network interface of Virtual Machine. Can be one of C(none), C(dhcp) or C(static).
|
|
|
|
- "C(nic_ip_address) - If boot protocol is static, set this IP address to network interface of Virtual Machine."
|
|
|
|
- C(nic_ip_address) - If boot protocol is static, set this IP address to network interface of Virtual Machine.
|
|
|
|
- "C(nic_netmask) - If boot protocol is static, set this netmask to network interface of Virtual Machine."
|
|
|
|
- C(nic_netmask) - If boot protocol is static, set this netmask to network interface of Virtual Machine.
|
|
|
|
- "C(nic_gateway) - If boot protocol is static, set this gateway to network interface of Virtual Machine."
|
|
|
|
- C(nic_gateway) - If boot protocol is static, set this gateway to network interface of Virtual Machine.
|
|
|
|
- "C(nic_name) - Set name to network interface of Virtual Machine."
|
|
|
|
- C(nic_name) - Set name to network interface of Virtual Machine.
|
|
|
|
- "C(nic_on_boot) - If I(True) network interface will be set to start on boot."
|
|
|
|
- C(nic_on_boot) - If I(True) network interface will be set to start on boot.
|
|
|
|
cloud_init_nics:
|
|
|
|
cloud_init_nics:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "List of dictionaries representing network interafaces to be setup by cloud init."
|
|
|
|
- List of dictionaries representing network interafaces to be setup by cloud init.
|
|
|
|
- "This option is used, when user needs to setup more network interfaces via cloud init."
|
|
|
|
- This option is used, when user needs to setup more network interfaces via cloud init.
|
|
|
|
- "If one network interface is enough, user should use C(cloud_init) I(nic_*) parameters. C(cloud_init) I(nic_*) parameters
|
|
|
|
- If one network interface is enough, user should use C(cloud_init) I(nic_*) parameters. C(cloud_init) I(nic_*) parameters
|
|
|
|
are merged with C(cloud_init_nics) parameters."
|
|
|
|
are merged with C(cloud_init_nics) parameters.
|
|
|
|
- "Dictionary can contain following values:"
|
|
|
|
- Dictionary can contain following values.
|
|
|
|
- "C(nic_boot_protocol) - Set boot protocol of the network interface of Virtual Machine. Can be one of none, dhcp or static."
|
|
|
|
- C(nic_boot_protocol) - Set boot protocol of the network interface of Virtual Machine. Can be one of C(none), C(dhcp) or C(static).
|
|
|
|
- "C(nic_ip_address) - If boot protocol is static, set this IP address to network interface of Virtual Machine."
|
|
|
|
- C(nic_ip_address) - If boot protocol is static, set this IP address to network interface of Virtual Machine.
|
|
|
|
- "C(nic_netmask) - If boot protocol is static, set this netmask to network interface of Virtual Machine."
|
|
|
|
- C(nic_netmask) - If boot protocol is static, set this netmask to network interface of Virtual Machine.
|
|
|
|
- "C(nic_gateway) - If boot protocol is static, set this gateway to network interface of Virtual Machine."
|
|
|
|
- C(nic_gateway) - If boot protocol is static, set this gateway to network interface of Virtual Machine.
|
|
|
|
- "C(nic_name) - Set name to network interface of Virtual Machine."
|
|
|
|
- C(nic_name) - Set name to network interface of Virtual Machine.
|
|
|
|
- "C(nic_on_boot) - If I(True) network interface will be set to start on boot."
|
|
|
|
- C(nic_on_boot) - If I(True) network interface will be set to start on boot.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
kernel_path:
|
|
|
|
kernel_path:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Path to a kernel image used to boot the virtual machine."
|
|
|
|
- Path to a kernel image used to boot the virtual machine.
|
|
|
|
- "Kernel image must be stored on either the ISO domain or on the host's storage."
|
|
|
|
- Kernel image must be stored on either the ISO domain or on the host's storage.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
initrd_path:
|
|
|
|
initrd_path:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Path to an initial ramdisk to be used with the kernel specified by C(kernel_path) option."
|
|
|
|
- Path to an initial ramdisk to be used with the kernel specified by C(kernel_path) option.
|
|
|
|
- "Ramdisk image must be stored on either the ISO domain or on the host's storage."
|
|
|
|
- Ramdisk image must be stored on either the ISO domain or on the host's storage.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
kernel_params:
|
|
|
|
kernel_params:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Kernel command line parameters (formatted as string) to be used with the kernel specified by C(kernel_path) option."
|
|
|
|
- Kernel command line parameters (formatted as string) to be used with the kernel specified by C(kernel_path) option.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
instance_type:
|
|
|
|
instance_type:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Name of virtual machine's hardware configuration."
|
|
|
|
- Name of virtual machine's hardware configuration.
|
|
|
|
- "By default no instance type is used."
|
|
|
|
- By default no instance type is used.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Description of the Virtual Machine."
|
|
|
|
- Description of the Virtual Machine.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
comment:
|
|
|
|
comment:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Comment of the Virtual Machine."
|
|
|
|
- Comment of the Virtual Machine.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
timezone:
|
|
|
|
timezone:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Sets time zone offset of the guest hardware clock."
|
|
|
|
- Sets time zone offset of the guest hardware clock.
|
|
|
|
- "For example: Etc/GMT"
|
|
|
|
- For example C(Etc/GMT)
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
serial_policy:
|
|
|
|
serial_policy:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Specify a serial number policy for the Virtual Machine."
|
|
|
|
- Specify a serial number policy for the Virtual Machine.
|
|
|
|
- "Following options are supported:"
|
|
|
|
- Following options are supported.
|
|
|
|
- "C(vm) - Sets the Virtual Machine's UUID as its serial number."
|
|
|
|
- C(vm) - Sets the Virtual Machine's UUID as its serial number.
|
|
|
|
- "C(host) - Sets the host's UUID as the Virtual Machine's serial number."
|
|
|
|
- C(host) - Sets the host's UUID as the Virtual Machine's serial number.
|
|
|
|
- "C(custom) - Allows you to specify a custom serial number in C(serial_policy_value)."
|
|
|
|
- C(custom) - Allows you to specify a custom serial number in C(serial_policy_value).
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
serial_policy_value:
|
|
|
|
serial_policy_value:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Allows you to specify a custom serial number."
|
|
|
|
- Allows you to specify a custom serial number.
|
|
|
|
- "This parameter is used only when C(serial_policy) is I(custom)."
|
|
|
|
- This parameter is used only when C(serial_policy) is I(custom).
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
vmware:
|
|
|
|
vmware:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Dictionary of values to be used to connect to VMware and import
|
|
|
|
- Dictionary of values to be used to connect to VMware and import
|
|
|
|
a virtual machine to oVirt."
|
|
|
|
a virtual machine to oVirt.
|
|
|
|
- "Dictionary can contain following values:"
|
|
|
|
- Dictionary can contain following values.
|
|
|
|
- "C(username) - The username to authenticate against the VMware."
|
|
|
|
- C(username) - The username to authenticate against the VMware.
|
|
|
|
- "C(password) - The password to authenticate against the VMware."
|
|
|
|
- C(password) - The password to authenticate against the VMware.
|
|
|
|
- "C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
- C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
For example: I(vpx://wmware_user@vcenter-host/DataCenter/Cluster/esxi-host?no_verify=1)"
|
|
|
|
For example I(vpx://wmware_user@vcenter-host/DataCenter/Cluster/esxi-host?no_verify=1)
|
|
|
|
- "C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
- C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
be used during the I(virt-v2v) conversion process."
|
|
|
|
be used during the I(virt-v2v) conversion process.
|
|
|
|
- "C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
- C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
virtual machine: I(true) for sparse, I(false) for preallocated.
|
|
|
|
virtual machine. I(true) for sparse, I(false) for preallocated.
|
|
|
|
Default value is I(true)."
|
|
|
|
Default value is I(true).
|
|
|
|
- "C(storage_domain) - Specifies the target storage domain for
|
|
|
|
- C(storage_domain) - Specifies the target storage domain for
|
|
|
|
converted disks. This is required parameter."
|
|
|
|
converted disks. This is required parameter.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
xen:
|
|
|
|
xen:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Dictionary of values to be used to connect to XEN and import
|
|
|
|
- Dictionary of values to be used to connect to XEN and import
|
|
|
|
a virtual machine to oVirt."
|
|
|
|
a virtual machine to oVirt.
|
|
|
|
- "Dictionary can contain following values:"
|
|
|
|
- Dictionary can contain following values.
|
|
|
|
- "C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
- C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
For example: I(xen+ssh://root@zen.server). This is required paramater."
|
|
|
|
For example I(xen+ssh://root@zen.server). This is required parameter.
|
|
|
|
- "C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
- C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
be used during the I(virt-v2v) conversion process."
|
|
|
|
be used during the I(virt-v2v) conversion process.
|
|
|
|
- "C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
- C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
virtual machine: I(true) for sparse, I(false) for preallocated.
|
|
|
|
virtual machine. I(true) for sparse, I(false) for preallocated.
|
|
|
|
Default value is I(true)."
|
|
|
|
Default value is I(true).
|
|
|
|
- "C(storage_domain) - Specifies the target storage domain for
|
|
|
|
- C(storage_domain) - Specifies the target storage domain for
|
|
|
|
converted disks. This is required parameter."
|
|
|
|
converted disks. This is required parameter.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
kvm:
|
|
|
|
kvm:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- "Dictionary of values to be used to connect to kvm and import
|
|
|
|
- Dictionary of values to be used to connect to kvm and import
|
|
|
|
a virtual machine to oVirt."
|
|
|
|
a virtual machine to oVirt.
|
|
|
|
- "Dictionary can contain following values:"
|
|
|
|
- Dictionary can contain following values.
|
|
|
|
- "C(name) - The name of the KVM virtual machine."
|
|
|
|
- C(name) - The name of the KVM virtual machine.
|
|
|
|
- "C(username) - The username to authenticate against the KVM."
|
|
|
|
- C(username) - The username to authenticate against the KVM.
|
|
|
|
- "C(password) - The password to authenticate against the KVM."
|
|
|
|
- C(password) - The password to authenticate against the KVM.
|
|
|
|
- "C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
- C(url) - The URL to be passed to the I(virt-v2v) tool for conversion.
|
|
|
|
For example: I(qemu:///system). This is required paramater."
|
|
|
|
For example I(qemu:///system). This is required parameter.
|
|
|
|
- "C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
- C(drivers_iso) - The name of the ISO containing drivers that can
|
|
|
|
be used during the I(virt-v2v) conversion process."
|
|
|
|
be used during the I(virt-v2v) conversion process.
|
|
|
|
- "C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
- C(sparse) - Specifies the disk allocation policy of the resulting
|
|
|
|
virtual machine: I(true) for sparse, I(false) for preallocated.
|
|
|
|
virtual machine. I(true) for sparse, I(false) for preallocated.
|
|
|
|
Default value is I(true)."
|
|
|
|
Default value is I(true).
|
|
|
|
- "C(storage_domain) - Specifies the target storage domain for
|
|
|
|
- C(storage_domain) - Specifies the target storage domain for
|
|
|
|
converted disks. This is required parameter."
|
|
|
|
converted disks. This is required parameter.
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
notes:
|
|
|
|
notes:
|
|
|
|
- "If VM is in I(UNASSIGNED) or I(UNKNOWN) state before any operation, the module will fail.
|
|
|
|
- If VM is in I(UNASSIGNED) or I(UNKNOWN) state before any operation, the module will fail.
|
|
|
|
If VM is in I(IMAGE_LOCKED) state before any operation, we try to wait for VM to be I(DOWN).
|
|
|
|
If VM is in I(IMAGE_LOCKED) state before any operation, we try to wait for VM to be I(DOWN).
|
|
|
|
If VM is in I(SAVING_STATE) state before any operation, we try to wait for VM to be I(SUSPENDED).
|
|
|
|
If VM is in I(SAVING_STATE) state before any operation, we try to wait for VM to be I(SUSPENDED).
|
|
|
|
If VM is in I(POWERING_DOWN) state before any operation, we try to wait for VM to be I(UP) or I(DOWN). VM can
|
|
|
|
If VM is in I(POWERING_DOWN) state before any operation, we try to wait for VM to be I(UP) or I(DOWN). VM can
|
|
|
@ -354,7 +383,7 @@ notes:
|
|
|
|
When user specify I(suspended) C(state), we always wait to VM to be in UP state in case VM is I(MIGRATING),
|
|
|
|
When user specify I(suspended) C(state), we always wait to VM to be in UP state in case VM is I(MIGRATING),
|
|
|
|
I(REBOOTING), I(POWERING_UP), I(RESTORING_STATE), I(WAIT_FOR_LAUNCH). If VM is in I(PAUSED) or I(DOWN) state,
|
|
|
|
I(REBOOTING), I(POWERING_UP), I(RESTORING_STATE), I(WAIT_FOR_LAUNCH). If VM is in I(PAUSED) or I(DOWN) state,
|
|
|
|
we start the VM. Then we suspend the VM.
|
|
|
|
we start the VM. Then we suspend the VM.
|
|
|
|
When user specify I(absent) C(state), we forcibly stop the VM in any state and remove it."
|
|
|
|
When user specify I(absent) C(state), we forcibly stop the VM in any state and remove it.
|
|
|
|
extends_documentation_fragment: ovirt
|
|
|
|
extends_documentation_fragment: ovirt
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -362,36 +391,36 @@ EXAMPLES = '''
|
|
|
|
# Examples don't contain auth parameter for simplicity,
|
|
|
|
# Examples don't contain auth parameter for simplicity,
|
|
|
|
# look at ovirt_auth module to see how to reuse authentication:
|
|
|
|
# look at ovirt_auth module to see how to reuse authentication:
|
|
|
|
|
|
|
|
|
|
|
|
# Creates a new Virtual Machine from template named 'rhel7_template'
|
|
|
|
- name: Creates a new Virtual Machine from template named 'rhel7_template'
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
template: rhel7_template
|
|
|
|
template: rhel7_template
|
|
|
|
|
|
|
|
|
|
|
|
# Register VM
|
|
|
|
- name: Register VM
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: registered
|
|
|
|
state: registered
|
|
|
|
storage_domain: mystorage
|
|
|
|
storage_domain: mystorage
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
|
|
|
|
|
|
|
|
# Register VM using id
|
|
|
|
- name: Register VM using id
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: registered
|
|
|
|
state: registered
|
|
|
|
storage_domain: mystorage
|
|
|
|
storage_domain: mystorage
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
|
id: 1111-1111-1111-1111
|
|
|
|
id: 1111-1111-1111-1111
|
|
|
|
|
|
|
|
|
|
|
|
# Register VM, allowing partial import
|
|
|
|
- name: Register VM, allowing partial import
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: registered
|
|
|
|
state: registered
|
|
|
|
storage_domain: mystorage
|
|
|
|
storage_domain: mystorage
|
|
|
|
allow_partial_import: "True"
|
|
|
|
allow_partial_import: "True"
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
|
id: 1111-1111-1111-1111
|
|
|
|
id: 1111-1111-1111-1111
|
|
|
|
|
|
|
|
|
|
|
|
# Creates a stateless VM which will always use latest template version:
|
|
|
|
- name: Creates a stateless VM which will always use latest template version
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
template: rhel7
|
|
|
|
template: rhel7
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
@ -400,7 +429,7 @@ ovirt_vms:
|
|
|
|
# Creates a new server rhel7 Virtual Machine from Blank template
|
|
|
|
# Creates a new server rhel7 Virtual Machine from Blank template
|
|
|
|
# on brq01 cluster with 2GiB memory and 2 vcpu cores/sockets
|
|
|
|
# on brq01 cluster with 2GiB memory and 2 vcpu cores/sockets
|
|
|
|
# and attach bootable disk with name rhel7_disk and attach virtio NIC
|
|
|
|
# and attach bootable disk with name rhel7_disk and attach virtio NIC
|
|
|
|
ovirt_vms:
|
|
|
|
- ovirt_vms:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
cluster: brq01
|
|
|
|
cluster: brq01
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
@ -416,8 +445,8 @@ ovirt_vms:
|
|
|
|
nics:
|
|
|
|
nics:
|
|
|
|
- name: nic1
|
|
|
|
- name: nic1
|
|
|
|
|
|
|
|
|
|
|
|
# Run VM with cloud init:
|
|
|
|
- name: Run VM with cloud init
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: rhel7
|
|
|
|
name: rhel7
|
|
|
|
template: rhel7
|
|
|
|
template: rhel7
|
|
|
|
cluster: Default
|
|
|
|
cluster: Default
|
|
|
@ -440,8 +469,8 @@ ovirt_vms:
|
|
|
|
user_name: root
|
|
|
|
user_name: root
|
|
|
|
root_password: super_password
|
|
|
|
root_password: super_password
|
|
|
|
|
|
|
|
|
|
|
|
# Run VM with cloud init, with multiple network interfaces:
|
|
|
|
- name: Run VM with cloud init, with multiple network interfaces
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: rhel7_4
|
|
|
|
name: rhel7_4
|
|
|
|
template: rhel7
|
|
|
|
template: rhel7
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
@ -456,8 +485,8 @@ ovirt_vms:
|
|
|
|
nic_gateway: 10.34.63.254
|
|
|
|
nic_gateway: 10.34.63.254
|
|
|
|
nic_on_boot: true
|
|
|
|
nic_on_boot: true
|
|
|
|
|
|
|
|
|
|
|
|
# Run VM with sysprep:
|
|
|
|
- name: Run VM with sysprep
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: windows2012R2_AD
|
|
|
|
name: windows2012R2_AD
|
|
|
|
template: windows2012R2
|
|
|
|
template: windows2012R2
|
|
|
|
cluster: Default
|
|
|
|
cluster: Default
|
|
|
@ -468,56 +497,55 @@ ovirt_vms:
|
|
|
|
user_name: Administrator
|
|
|
|
user_name: Administrator
|
|
|
|
root_password: SuperPassword123
|
|
|
|
root_password: SuperPassword123
|
|
|
|
|
|
|
|
|
|
|
|
# Migrate/Run VM to/on host named 'host1'
|
|
|
|
- name: Migrate/Run VM to/on host named 'host1'
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: running
|
|
|
|
state: running
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
host: host1
|
|
|
|
host: host1
|
|
|
|
|
|
|
|
|
|
|
|
# Change Vm's CD:
|
|
|
|
- name: Change VMs CD
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
cd_iso: drivers.iso
|
|
|
|
cd_iso: drivers.iso
|
|
|
|
|
|
|
|
|
|
|
|
# Eject Vm's CD:
|
|
|
|
- name: Eject VMs CD
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
cd_iso: ''
|
|
|
|
cd_iso: ''
|
|
|
|
|
|
|
|
|
|
|
|
# Boot VM from CD:
|
|
|
|
- name: Boot VM from CD
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
cd_iso: centos7_x64.iso
|
|
|
|
cd_iso: centos7_x64.iso
|
|
|
|
boot_devices:
|
|
|
|
boot_devices:
|
|
|
|
- cdrom
|
|
|
|
- cdrom
|
|
|
|
|
|
|
|
|
|
|
|
# Stop vm:
|
|
|
|
- name: Stop vm
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: stopped
|
|
|
|
state: stopped
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
|
|
|
|
|
|
|
|
# Upgrade memory to already created VM:
|
|
|
|
- name: Upgrade memory to already created VM
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
memory: 4GiB
|
|
|
|
memory: 4GiB
|
|
|
|
|
|
|
|
|
|
|
|
# Hot plug memory to already created and running VM:
|
|
|
|
- name: Hot plug memory to already created and running VM (VM won't be restarted)
|
|
|
|
# (VM won't be restarted)
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
memory: 4GiB
|
|
|
|
memory: 4GiB
|
|
|
|
|
|
|
|
|
|
|
|
# When change on the VM needs restart of the VM, use next_run state,
|
|
|
|
# When change on the VM needs restart of the VM, use next_run state,
|
|
|
|
# The VM will be updated and rebooted if there are any changes.
|
|
|
|
# The VM will be updated and rebooted if there are any changes.
|
|
|
|
# If present state would be used, VM won't be restarted.
|
|
|
|
# If present state would be used, VM won't be restarted.
|
|
|
|
ovirt_vms:
|
|
|
|
- ovirt_vms:
|
|
|
|
state: next_run
|
|
|
|
state: next_run
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
boot_devices:
|
|
|
|
boot_devices:
|
|
|
|
- network
|
|
|
|
- network
|
|
|
|
|
|
|
|
|
|
|
|
# Import virtual machine from VMware:
|
|
|
|
- name: Import virtual machine from VMware
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: stopped
|
|
|
|
state: stopped
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
|
name: vmware_win10
|
|
|
|
name: vmware_win10
|
|
|
@ -530,8 +558,8 @@ ovirt_vms:
|
|
|
|
username: user
|
|
|
|
username: user
|
|
|
|
password: password
|
|
|
|
password: password
|
|
|
|
|
|
|
|
|
|
|
|
# create vm from template and create all disks on specific storage domain
|
|
|
|
- name: Create vm from template and create all disks on specific storage domain
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
name: vm_test
|
|
|
|
name: vm_test
|
|
|
|
cluster: mycluster
|
|
|
|
cluster: mycluster
|
|
|
|
template: mytemplate
|
|
|
|
template: mytemplate
|
|
|
@ -539,8 +567,8 @@ ovirt_vms:
|
|
|
|
nics:
|
|
|
|
nics:
|
|
|
|
- name: nic1
|
|
|
|
- name: nic1
|
|
|
|
|
|
|
|
|
|
|
|
# Remove VM, if VM is running it will be stopped:
|
|
|
|
- name: Remove VM, if VM is running it will be stopped
|
|
|
|
ovirt_vms:
|
|
|
|
ovirt_vms:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
name: myvm
|
|
|
|
name: myvm
|
|
|
|
'''
|
|
|
|
'''
|
|
|
@ -720,26 +748,25 @@ class VmsModule(BaseModule):
|
|
|
|
|
|
|
|
|
|
|
|
def update_check(self, entity):
|
|
|
|
def update_check(self, entity):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
equal(self.param('cluster'), get_link_name(self._connection, entity.cluster))
|
|
|
|
equal(self.param('cluster'), get_link_name(self._connection, entity.cluster)) and equal(convert_to_bytes(self.param('memory')), entity.memory) and
|
|
|
|
and equal(convert_to_bytes(self.param('memory')), entity.memory)
|
|
|
|
equal(convert_to_bytes(self.param('memory_guaranteed')), entity.memory_policy.guaranteed) and
|
|
|
|
and equal(convert_to_bytes(self.param('memory_guaranteed')), entity.memory_policy.guaranteed)
|
|
|
|
equal(self.param('cpu_cores'), entity.cpu.topology.cores) and
|
|
|
|
and equal(self.param('cpu_cores'), entity.cpu.topology.cores)
|
|
|
|
equal(self.param('cpu_sockets'), entity.cpu.topology.sockets) and
|
|
|
|
and equal(self.param('cpu_sockets'), entity.cpu.topology.sockets)
|
|
|
|
equal(self.param('type'), str(entity.type)) and
|
|
|
|
and equal(self.param('type'), str(entity.type))
|
|
|
|
equal(self.param('operating_system'), str(entity.os.type)) and
|
|
|
|
and equal(self.param('operating_system'), str(entity.os.type))
|
|
|
|
equal(self.param('high_availability'), entity.high_availability.enabled) and
|
|
|
|
and equal(self.param('high_availability'), entity.high_availability.enabled)
|
|
|
|
equal(self.param('lease'), get_link_name(self._connection, getattr(entity.lease, 'storage_domain', None))) and
|
|
|
|
and equal(self.param('lease'), get_link_name(self._connection, getattr(entity.lease, 'storage_domain', None)))
|
|
|
|
equal(self.param('stateless'), entity.stateless) and
|
|
|
|
and equal(self.param('stateless'), entity.stateless)
|
|
|
|
equal(self.param('cpu_shares'), entity.cpu_shares) and
|
|
|
|
and equal(self.param('cpu_shares'), entity.cpu_shares)
|
|
|
|
equal(self.param('delete_protected'), entity.delete_protected) and
|
|
|
|
and equal(self.param('delete_protected'), entity.delete_protected)
|
|
|
|
equal(self.param('use_latest_template_version'), entity.use_latest_template_version) and
|
|
|
|
and equal(self.param('use_latest_template_version'), entity.use_latest_template_version)
|
|
|
|
equal(self.param('boot_devices'), [str(dev) for dev in getattr(entity.os, 'devices', [])]) and
|
|
|
|
and equal(self.param('boot_devices'), [str(dev) for dev in getattr(entity.os, 'devices', [])])
|
|
|
|
equal(self.param('instance_type'), get_link_name(self._connection, entity.instance_type), ignore_case=True) and
|
|
|
|
and equal(self.param('instance_type'), get_link_name(self._connection, entity.instance_type), ignore_case=True)
|
|
|
|
equal(self.param('description'), entity.description) and
|
|
|
|
and equal(self.param('description'), entity.description)
|
|
|
|
equal(self.param('comment'), entity.comment) and
|
|
|
|
and equal(self.param('comment'), entity.comment)
|
|
|
|
equal(self.param('timezone'), getattr(entity.time_zone, 'name', None)) and
|
|
|
|
and equal(self.param('timezone'), getattr(entity.time_zone, 'name', None))
|
|
|
|
equal(self.param('serial_policy'), str(getattr(entity.serial_number, 'policy', None))) and
|
|
|
|
and equal(self.param('serial_policy'), str(getattr(entity.serial_number, 'policy', None)))
|
|
|
|
equal(self.param('serial_policy_value'), getattr(entity.serial_number, 'value', None))
|
|
|
|
and equal(self.param('serial_policy_value'), getattr(entity.serial_number, 'value', None))
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def pre_create(self, entity):
|
|
|
|
def pre_create(self, entity):
|
|
|
@ -1122,30 +1149,27 @@ def control_state(vm, vms_service, module):
|
|
|
|
condition=lambda vm: vm.status in [otypes.VmStatus.DOWN, otypes.VmStatus.UP],
|
|
|
|
condition=lambda vm: vm.status in [otypes.VmStatus.DOWN, otypes.VmStatus.UP],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
argument_spec = ovirt_full_argument_spec(
|
|
|
|
argument_spec = ovirt_full_argument_spec(
|
|
|
|
state=dict(
|
|
|
|
state=dict(type='str', default='present', choices=['absent', 'next_run', 'present', 'registered', 'running', 'stopped', 'suspended']),
|
|
|
|
choices=['running', 'stopped', 'present', 'absent', 'suspended', 'next_run', 'registered'],
|
|
|
|
name=dict(type='str'),
|
|
|
|
default='present',
|
|
|
|
id=dict(type='str'),
|
|
|
|
),
|
|
|
|
cluster=dict(type='str'),
|
|
|
|
name=dict(default=None),
|
|
|
|
allow_partial_import=dict(type='bool'),
|
|
|
|
id=dict(default=None),
|
|
|
|
template=dict(type='str'),
|
|
|
|
cluster=dict(default=None),
|
|
|
|
template_version=dict(type='int'),
|
|
|
|
allow_partial_import=dict(default=None, type='bool'),
|
|
|
|
use_latest_template_version=dict(type='bool'),
|
|
|
|
template=dict(default=None),
|
|
|
|
storage_domain=dict(type='str'),
|
|
|
|
template_version=dict(default=None, type='int'),
|
|
|
|
disk_format=dict(type='str', default='cow', choices=['cow', 'raw']),
|
|
|
|
use_latest_template_version=dict(default=None, type='bool'),
|
|
|
|
disks=dict(type='list', default=[]),
|
|
|
|
storage_domain=dict(default=None),
|
|
|
|
memory=dict(type='str'),
|
|
|
|
disk_format=dict(choices=['cow','raw'], default='cow'),
|
|
|
|
memory_guaranteed=dict(type='str'),
|
|
|
|
disks=dict(default=[], type='list'),
|
|
|
|
cpu_sockets=dict(type='int'),
|
|
|
|
memory=dict(default=None),
|
|
|
|
cpu_cores=dict(type='int'),
|
|
|
|
memory_guaranteed=dict(default=None),
|
|
|
|
cpu_shares=dict(type='int'),
|
|
|
|
cpu_sockets=dict(default=None, type='int'),
|
|
|
|
type=dict(type='str', choices=['server', 'desktop']),
|
|
|
|
cpu_cores=dict(default=None, type='int'),
|
|
|
|
operating_system=dict(type='str',
|
|
|
|
cpu_shares=dict(default=None, type='int'),
|
|
|
|
|
|
|
|
type=dict(choices=['server', 'desktop']),
|
|
|
|
|
|
|
|
operating_system=dict(
|
|
|
|
|
|
|
|
default=None,
|
|
|
|
|
|
|
|
choices=[
|
|
|
|
choices=[
|
|
|
|
'rhel_6_ppc64', 'other', 'freebsd', 'windows_2003x64', 'windows_10',
|
|
|
|
'rhel_6_ppc64', 'other', 'freebsd', 'windows_2003x64', 'windows_10',
|
|
|
|
'rhel_6x64', 'rhel_4x64', 'windows_2008x64', 'windows_2008R2x64',
|
|
|
|
'rhel_6x64', 'rhel_4x64', 'windows_2008x64', 'windows_2008R2x64',
|
|
|
@ -1157,34 +1181,33 @@ def main():
|
|
|
|
'ubuntu_14_04_ppc64', 'sles_11_ppc64', 'windows_8',
|
|
|
|
'ubuntu_14_04_ppc64', 'sles_11_ppc64', 'windows_8',
|
|
|
|
'windows_2012R2x64', 'windows_2008r2x64', 'ubuntu_13_04',
|
|
|
|
'windows_2012R2x64', 'windows_2008r2x64', 'ubuntu_13_04',
|
|
|
|
'ubuntu_12_10', 'windows_7x64',
|
|
|
|
'ubuntu_12_10', 'windows_7x64',
|
|
|
|
],
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
cd_iso=dict(type='str'),
|
|
|
|
cd_iso=dict(default=None),
|
|
|
|
boot_devices=dict(type='list'),
|
|
|
|
boot_devices=dict(default=None, type='list'),
|
|
|
|
|
|
|
|
high_availability=dict(type='bool'),
|
|
|
|
high_availability=dict(type='bool'),
|
|
|
|
lease=dict(default=None),
|
|
|
|
lease=dict(type='str'),
|
|
|
|
stateless=dict(type='bool'),
|
|
|
|
stateless=dict(type='bool'),
|
|
|
|
delete_protected=dict(type='bool'),
|
|
|
|
delete_protected=dict(type='bool'),
|
|
|
|
force=dict(type='bool', default=False),
|
|
|
|
force=dict(type='bool', default=False),
|
|
|
|
nics=dict(default=[], type='list'),
|
|
|
|
nics=dict(type='list', default=[]),
|
|
|
|
cloud_init=dict(type='dict'),
|
|
|
|
cloud_init=dict(type='dict'),
|
|
|
|
cloud_init_nics=dict(defaul=[], type='list'),
|
|
|
|
cloud_init_nics=dict(type='list', default=[]),
|
|
|
|
sysprep=dict(type='dict'),
|
|
|
|
sysprep=dict(type='dict'),
|
|
|
|
host=dict(default=None),
|
|
|
|
host=dict(type='str'),
|
|
|
|
clone=dict(type='bool', default=False),
|
|
|
|
clone=dict(type='bool', default=False),
|
|
|
|
clone_permissions=dict(type='bool', default=False),
|
|
|
|
clone_permissions=dict(type='bool', default=False),
|
|
|
|
kernel_path=dict(default=None),
|
|
|
|
kernel_path=dict(type='str'),
|
|
|
|
initrd_path=dict(default=None),
|
|
|
|
initrd_path=dict(type='str'),
|
|
|
|
kernel_params=dict(default=None),
|
|
|
|
kernel_params=dict(type='str'),
|
|
|
|
instance_type=dict(default=None),
|
|
|
|
instance_type=dict(type='str'),
|
|
|
|
description=dict(default=None),
|
|
|
|
description=dict(type='str'),
|
|
|
|
comment=dict(default=None),
|
|
|
|
comment=dict(type='str'),
|
|
|
|
timezone=dict(default=None),
|
|
|
|
timezone=dict(type='str'),
|
|
|
|
serial_policy=dict(default=None, choices=['vm', 'host', 'custom']),
|
|
|
|
serial_policy=dict(type='str', choices=['vm', 'host', 'custom']),
|
|
|
|
serial_policy_value=dict(default=None),
|
|
|
|
serial_policy_value=dict(type='str'),
|
|
|
|
vmware=dict(default=None, type='dict'),
|
|
|
|
vmware=dict(type='dict'),
|
|
|
|
xen=dict(default=None, type='dict'),
|
|
|
|
xen=dict(type='dict'),
|
|
|
|
kvm=dict(default=None, type='dict'),
|
|
|
|
kvm=dict(type='dict'),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
@ -1256,16 +1279,16 @@ def main():
|
|
|
|
initrd=module.params.get('initrd_path'),
|
|
|
|
initrd=module.params.get('initrd_path'),
|
|
|
|
kernel=module.params.get('kernel_path'),
|
|
|
|
kernel=module.params.get('kernel_path'),
|
|
|
|
) if (
|
|
|
|
) if (
|
|
|
|
module.params.get('kernel_params')
|
|
|
|
module.params.get('kernel_params') or
|
|
|
|
or module.params.get('initrd_path')
|
|
|
|
module.params.get('initrd_path') or
|
|
|
|
or module.params.get('kernel_path')
|
|
|
|
module.params.get('kernel_path')
|
|
|
|
) else None,
|
|
|
|
) else None,
|
|
|
|
) if (
|
|
|
|
) if (
|
|
|
|
module.params.get('kernel_params')
|
|
|
|
module.params.get('kernel_params') or
|
|
|
|
or module.params.get('initrd_path')
|
|
|
|
module.params.get('initrd_path') or
|
|
|
|
or module.params.get('kernel_path')
|
|
|
|
module.params.get('kernel_path') or
|
|
|
|
or module.params.get('host')
|
|
|
|
module.params.get('host') or
|
|
|
|
or initialization
|
|
|
|
initialization
|
|
|
|
) else None,
|
|
|
|
) else None,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|