ovirt_template – Module to manage virtual machine templates in oVirt/RHV
ovirt_template – Module to manage virtual machine templates in oVirt/RHV
New in version 2.3.
Synopsis
- Module to manage virtual machine templates in oVirt/RHV.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.7
- ovirt-engine-sdk-python >= 4.3.0
Parameters
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
allow_partial_import boolean added in 2.4 |
|
Boolean indication whether to allow partial registration of a template when | |
auth dictionary / required |
Dictionary with values needed to create HTTP/HTTPS connection to oVirt: | ||
ca_file string |
A PEM file containing the trusted CA certificates. The certificate presented by the server will be verified using these CA certificates. If Default value is set by | ||
headers dictionary |
Dictionary of HTTP headers to be added to each API call. | ||
hostname string |
A string containing the hostname of the server, usually something like `server.example.com`. Default value is set by Either | ||
insecure boolean |
|
A boolean flag that indicates if the server TLS certificate and host name should be checked. | |
kerberos boolean |
|
A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication. | |
password string / required |
The password of the user. Default value is set by | ||
token string |
Token to be used instead of login with username/password. Default value is set by | ||
url string |
A string containing the API URL of the server, usually something like `https://server.example.com/ovirt-engine/api`. Default value is set by Either | ||
username string / required |
The name of the user, something like admin@internal. Default value is set by | ||
clone_name - added in 2.8 |
Name for importing Template from storage domain. If not defined, | ||
clone_permissions boolean |
|
If True then the permissions of the VM (only the direct ones, not the inherited ones) will be copied to the created template. This parameter is used only when | |
cluster - |
Name of the cluster, where template should be created/imported. | ||
cluster_mappings - added in 2.5 |
Mapper which maps cluster name between Template's OVF and the destination cluster this Template should be registered to, relevant when | ||
dest_name - |
The name of the destination cluster. | ||
source_name - |
The name of the source cluster. | ||
cpu_profile - |
CPU profile to be set to template. | ||
description - |
Description of the template. | ||
domain_mappings - added in 2.5 |
Mapper which maps aaa domain name between Template's OVF and the destination aaa domain this Template should be registered to, relevant when | ||
dest_name - |
The name of the destination aaa domain. | ||
source_name - |
The name of the source aaa domain. | ||
exclusive boolean |
|
When | |
export_domain - |
When | ||
fetch_nested boolean added in 2.3 |
|
If True the module will fetch additional data from the API. It will fetch IDs of the VMs disks, snapshots, etc. User can configure to fetch other attributes of the nested entities by specifying | |
id - added in 2.4 |
ID of the template to be registered. | ||
image_disk - |
When
| ||
image_provider - |
When | ||
io_threads - added in 2.7 |
Number of IO threads used by virtual machine. 0 means IO threading disabled. | ||
memory - added in 2.6 |
Amount of memory of the template. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB). | ||
memory_guaranteed - added in 2.6 |
Amount of minimal guaranteed memory of the template. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB).
| ||
memory_max - added in 2.6 |
Upper bound of template memory up to which memory hot-plug can be performed. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB). | ||
name - |
Name of the template to manage. | ||
nested_attributes list added in 2.3 |
Specifies list of the attributes which should be fetched from the API. This parameter apply only when | ||
operating_system - added in 2.6 |
Operating system of the template. Default value is set by oVirt/RHV engine. Possible values are: debian_7, freebsd, freebsdx64, other, 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 | ||
poll_interval integer |
Default: 3 |
Number of the seconds the module waits until another poll request on entity status is sent. | |
role_mappings - added in 2.5 |
Mapper which maps role name between Template's OVF and the destination role this Template should be registered to, relevant when | ||
dest_name - |
The name of the destination role. | ||
source_name - |
The name of the source role. | ||
seal boolean added in 2.5 |
|
'Sealing' is an operation that erases all machine-specific configurations from a filesystem: This includes SSH keys, UDEV rules, MAC addresses, system ID, hostname, etc. If true subsequent virtual machines made from this template will avoid configuration inheritance. This parameter is used only when | |
state - |
|
Should the template be present/absent/exported/imported/registered. When | |
storage_domain - |
When | ||
template_image_disk_name - added in 2.4 |
When | ||
timeout integer |
Default: 180 |
The amount of time in seconds the module should wait for the instance to get into desired state. | |
version - added in 2.8 |
| ||
vm - |
Name of the VM, which will be used to create template. | ||
vnic_profile_mappings - added in 2.5 |
Mapper which maps an external virtual NIC profile to one that exists in the engine when | ||
source_network_name - |
The network name of the source network. | ||
source_profile_name - |
The profile name related to the source network. | ||
target_profile_id - |
The id of the target profile id to be mapped to in the engine. | ||
wait boolean |
|
|
Notes
Note
- In order to use this module you have to install oVirt Python SDK. To ensure it’s installed with correct version you can create the following task: pip: name=ovirt-engine-sdk-python version=4.3.0
Examples
# Examples don't contain auth parameter for simplicity,
# look at ovirt_auth module to see how to reuse authentication:
# Create template from vm
- ovirt_template:
cluster: Default
name: mytemplate
vm: rhel7
cpu_profile: Default
description: Test
# Import template
- ovirt_template:
state: imported
name: mytemplate
export_domain: myexport
storage_domain: mystorage
cluster: mycluster
# Remove template
- ovirt_template:
state: absent
name: mytemplate
# Change Template Name
- ovirt_template:
id: 00000000-0000-0000-0000-000000000000
name: "new_template_name"
# Register template
- ovirt_template:
state: registered
storage_domain: mystorage
cluster: mycluster
name: mytemplate
# Register template using id
- ovirt_template:
state: registered
storage_domain: mystorage
cluster: mycluster
id: 1111-1111-1111-1111
# Register template, allowing partial import
- ovirt_template:
state: registered
storage_domain: mystorage
allow_partial_import: "True"
cluster: mycluster
id: 1111-1111-1111-1111
# Register template with vnic profile mappings
- ovirt_template:
state: registered
storage_domain: mystorage
cluster: mycluster
id: 1111-1111-1111-1111
vnic_profile_mappings:
- source_network_name: mynetwork
source_profile_name: mynetwork
target_profile_id: 3333-3333-3333-3333
- source_network_name: mynetwork2
source_profile_name: mynetwork2
target_profile_id: 4444-4444-4444-4444
# Register template with mapping
- ovirt_template:
state: registered
storage_domain: mystorage
cluster: mycluster
id: 1111-1111-1111-1111
role_mappings:
- source_name: Role_A
dest_name: Role_B
domain_mappings:
- source_name: Domain_A
dest_name: Domain_B
cluster_mappings:
- source_name: cluster_A
dest_name: cluster_B
# Import image from Glance s a template
- ovirt_template:
state: imported
name: mytemplate
image_disk: "centos7"
template_image_disk_name: centos7_from_glance
image_provider: "glance_domain"
storage_domain: mystorage
cluster: mycluster
# Edit template subversion
- ovirt_template:
cluster: mycluster
name: mytemplate
vm: rhel7
version:
number: 2
name: subversion
# Create new template subversion
- ovirt_template:
cluster: mycluster
name: mytemplate
vm: rhel7
version:
name: subversion
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
id string |
On success if template is found. |
ID of the template which is managed
Sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c |
template dictionary |
On success if template is found. |
Dictionary of all the template attributes. Template attributes can be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/template.
|
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Ondra Machacek (@machacekondra)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/ovirt_template_module.html