pkubica / pkubica.ovirt / 1.4.3 / module / ovirt_vm Module to manage Virtual Machines in oVirt/RHV | "added in version" 1.0.0 of pkubica.ovirt" Authors: Ondra Machacek (@machacekondra), Martin Necas (@mnecas)pkubica.ovirt.ovirt_vm (1.4.3) — module
Install with ansible-galaxy collection install pkubica.ovirt:==1.4.3
collections: - name: pkubica.ovirt version: 1.4.3
This module manages whole lifecycle of the Virtual Machine(VM) in oVirt/RHV.
Since VM can hold many states in oVirt/RHV, this see notes to see how the states of the VM are handled.
# Examples don't contain auth parameter for simplicity, # look at ovirt_auth module to see how to reuse authentication: - name: Creates a new Virtual Machine from template named 'rhel7_template' pkubica.ovirt.ovirt_vm: state: present name: myvm template: rhel7_template cluster: mycluster
- name: Register VM pkubica.ovirt.ovirt_vm: state: registered storage_domain: mystorage cluster: mycluster name: myvm
- name: Register VM using id pkubica.ovirt.ovirt_vm: state: registered storage_domain: mystorage cluster: mycluster id: 1111-1111-1111-1111
- name: Register VM, allowing partial import pkubica.ovirt.ovirt_vm: state: registered storage_domain: mystorage allow_partial_import: "True" cluster: mycluster id: 1111-1111-1111-1111
- name: Register VM with vnic profile mappings and reassign bad macs pkubica.ovirt.ovirt_vm: 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 reassign_bad_macs: "True"
- name: Register VM with mappings pkubica.ovirt.ovirt_vm: 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 lun_mappings: - source_storage_type: iscsi source_logical_unit_id: 1IET_000d0001 source_logical_unit_port: 3260 source_logical_unit_portal: 1 source_logical_unit_address: 10.34.63.203 source_logical_unit_target: iqn.2016-08-09.brq.str-01:omachace dest_storage_type: iscsi dest_logical_unit_id: 1IET_000d0002 dest_logical_unit_port: 3260 dest_logical_unit_portal: 1 dest_logical_unit_address: 10.34.63.204 dest_logical_unit_target: iqn.2016-08-09.brq.str-02:omachace affinity_group_mappings: - source_name: Affinity_A dest_name: Affinity_B affinity_label_mappings: - source_name: Label_A dest_name: Label_B cluster_mappings: - source_name: cluster_A dest_name: cluster_B
- name: Creates a stateless VM which will always use latest template version pkubica.ovirt.ovirt_vm: name: myvm template: rhel7 cluster: mycluster use_latest_template_version: true
# Creates a new server rhel7 Virtual Machine from Blank template # on brq01 cluster with 2GiB memory and 2 vcpu cores/sockets # and attach bootable disk with name rhel7_disk and attach virtio NIC - pkubica.ovirt.ovirt_vm: state: present cluster: brq01 name: myvm memory: 2GiB cpu_cores: 2 cpu_sockets: 2 cpu_shares: 1024 type: server operating_system: rhel_7x64 disks: - name: rhel7_disk bootable: True nics: - name: nic1
# Change VM Name - pkubica.ovirt.ovirt_vm: id: 00000000-0000-0000-0000-000000000000 name: "new_vm_name"
- name: Run VM with cloud init pkubica.ovirt.ovirt_vm: name: rhel7 template: rhel7 cluster: Default memory: 1GiB high_availability: true high_availability_priority: 50 # Available from Ansible 2.5 cloud_init: dns_servers: '8.8.8.8 8.8.4.4' nic_boot_protocol: static nic_ip_address: 10.34.60.86 nic_netmask: 255.255.252.0 nic_gateway: 10.34.63.254 nic_name: eth1 host_name: example.com custom_script: | write_files: - content: | Hello, world! path: /tmp/greeting.txt permissions: '0644' user_name: root root_password: super_password
- name: Run VM with cloud init, with multiple network interfaces pkubica.ovirt.ovirt_vm: name: rhel7_4 template: rhel7 cluster: mycluster cloud_init_nics: - nic_name: eth0 nic_boot_protocol: dhcp - nic_name: eth1 nic_boot_protocol: static nic_ip_address: 10.34.60.86 nic_netmask: 255.255.252.0 nic_gateway: 10.34.63.254 # IP version 6 parameters are supported since ansible 2.9 - nic_name: eth2 nic_boot_protocol_v6: static nic_ip_address_v6: '2620:52:0:2282:b898:1f69:6512:36c5' nic_gateway_v6: '2620:52:0:2282:b898:1f69:6512:36c9' nic_netmask_v6: '120' - nic_name: eth3 nic_boot_protocol_v6: dhcp
- name: Run VM with sysprep pkubica.ovirt.ovirt_vm: name: windows2012R2_AD template: windows2012R2 cluster: Default memory: 3GiB high_availability: true sysprep: host_name: windowsad.example.com user_name: Administrator root_password: SuperPassword123
- name: Migrate/Run VM to/on host named 'host1' pkubica.ovirt.ovirt_vm: state: running name: myvm host: host1
- name: Migrate VM to any available host pkubica.ovirt.ovirt_vm: state: running name: myvm migrate: true
- name: Change VMs CD pkubica.ovirt.ovirt_vm: name: myvm cd_iso: drivers.iso
- name: Eject VMs CD pkubica.ovirt.ovirt_vm: name: myvm cd_iso: ''
- name: Boot VM from CD pkubica.ovirt.ovirt_vm: name: myvm cd_iso: centos7_x64.iso boot_devices: - cdrom
- name: Stop vm pkubica.ovirt.ovirt_vm: state: stopped name: myvm
- name: Upgrade memory to already created VM pkubica.ovirt.ovirt_vm: name: myvm memory: 4GiB
- name: Hot plug memory to already created and running VM (VM won't be restarted) pkubica.ovirt.ovirt_vm: name: myvm memory: 4GiB
# Create/update a VM to run with two vNUMA nodes and pin them to physical NUMA nodes as follows: # vnuma index 0-> numa index 0, vnuma index 1-> numa index 1 - name: Create a VM to run with two vNUMA nodes pkubica.ovirt.ovirt_vm: name: myvm cluster: mycluster numa_tune_mode: "interleave" numa_nodes: - index: 0 cores: [0] memory: 20 numa_node_pins: [0] - index: 1 cores: [1] memory: 30 numa_node_pins: [1]
- name: Update an existing VM to run without previously created vNUMA nodes (i.e. remove all vNUMA nodes+NUMA pinning setting) pkubica.ovirt.ovirt_vm: name: myvm cluster: mycluster state: "present" numa_tune_mode: "interleave" numa_nodes: - index: -1
# 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. # If present state would be used, VM won't be restarted. - pkubica.ovirt.ovirt_vm: state: next_run name: myvm boot_devices: - network
- name: Import virtual machine from VMware pkubica.ovirt.ovirt_vm: state: stopped cluster: mycluster name: vmware_win10 timeout: 1800 poll_interval: 30 vmware: url: vpx://user@1.2.3.4/Folder1/Cluster1/2.3.4.5?no_verify=1 name: windows10 storage_domain: mynfs username: user password: password
- name: Create vm from template and create all disks on specific storage domain pkubica.ovirt.ovirt_vm: name: vm_test cluster: mycluster template: mytemplate storage_domain: mynfs nics: - name: nic1
- name: Remove VM, if VM is running it will be stopped pkubica.ovirt.ovirt_vm: state: absent name: myvm
# Defining a specific quota for a VM: # Since Ansible 2.5 - pkubica.ovirt.ovirt_quotas_info: data_center: Default name: myquota register: ovirt_quotas
- pkubica.ovirt.ovirt_vm: name: myvm sso: False boot_menu: True bios_type: q35_ovmf usb_support: True serial_console: True quota_id: "{{ ovirt_quotas[0]['id'] }}"
- name: Create a VM that has the console configured for both Spice and VNC pkubica.ovirt.ovirt_vm: name: myvm template: mytemplate cluster: mycluster graphical_console: protocol: - spice - vnc
# Execute remote viewer to VM - block: - name: Create a ticket for console for a running VM pkubica.ovirt.ovirt_vm: name: myvm ticket: true state: running register: myvm - name: Save ticket to file ansible.builtin.copy: content: "{{ myvm.vm.remote_vv_file }}" dest: ~/vvfile.vv - name: Run remote viewer with file ansible.builtin.command: remote-viewer ~/vvfile.vv
# Default value of host_device state is present - name: Attach host devices to virtual machine pkubica.ovirt.ovirt_vm: name: myvm host: myhost placement_policy: pinned host_devices: - name: pci_0000_00_06_0 - name: pci_0000_00_07_0 state: absent - name: pci_0000_00_08_0 state: present
- name: Export the VM as OVA pkubica.ovirt.ovirt_vm: name: myvm state: exported cluster: mycluster export_ova: host: myhost filename: myvm.ova directory: /tmp/
- name: Clone VM from snapshot pkubica.ovirt.ovirt_vm: snapshot_vm: myvm snapshot_name: myvm_snap name: myvm_clone state: present
- name: Import external ova VM pkubica.ovirt.ovirt_vm: cluster: mycluster name: myvm host: myhost timeout: 1800 poll_interval: 30 kvm: name: myvm url: ova:///path/myvm.ova storage_domain: mystorage
- name: Cpu pinning of 0#12_1#13_2#14_3#15 pkubica.ovirt.ovirt_vm: state: present cluster: mycluster name: myvm cpu_pinning: - cpu: 12 vcpu: 0 - cpu: 13 vcpu: 1 - cpu: 14 vcpu: 2 - cpu: 15 vcpu: 3
id: description: - ID of the Virtual Machine to manage. type: str kvm: description: - Dictionary of values to be used to connect to kvm and import a virtual machine to oVirt. suboptions: drivers_iso: description: - The name of the ISO containing drivers that can be used during the I(virt-v2v) conversion process. name: description: - The name of the KVM virtual machine. password: description: - The password to authenticate against the KVM. sparse: default: true description: - Specifies the disk allocation policy of the resulting virtual machine. I(true) for sparse, I(false) for preallocated. type: bool storage_domain: description: - Specifies the target storage domain for converted disks. This is required parameter. url: description: - The URL to be passed to the I(virt-v2v) tool for conversion. - For example I(qemu:///system). This is required parameter. username: description: - The username to authenticate against the KVM. type: dict sso: description: - I(True) enable Single Sign On by Guest Agent, I(False) to disable it. By default is chosen by oVirt/RHV engine. type: bool xen: description: - Dictionary of values to be used to connect to XEN and import a virtual machine to oVirt. suboptions: drivers_iso: description: - The name of the ISO containing drivers that can be used during the I(virt-v2v) conversion process. sparse: default: true description: - Specifies the disk allocation policy of the resulting virtual machine. I(true) for sparse, I(false) for preallocated. type: bool storage_domain: description: - Specifies the target storage domain for converted disks. This is required parameter. url: description: - The URL to be passed to the I(virt-v2v) tool for conversion. - For example I(xen+ssh://root@zen.server). This is required parameter. type: dict auth: description: - 'Dictionary with values needed to create HTTP/HTTPS connection to oVirt:' required: true suboptions: ca_file: description: - A PEM file containing the trusted CA certificates. - The certificate presented by the server will be verified using these CA certificates. - If C(ca_file) parameter is not set, system wide CA certificate store is used. - Default value is set by C(OVIRT_CAFILE) environment variable. type: str compress: default: true description: Flag indicating if compression is used for connection. type: bool headers: description: - Dictionary of HTTP headers to be added to each API call. type: dict hostname: description: - A string containing the hostname of the server, usually something like `I(server.example.com)`. - Default value is set by C(OVIRT_HOSTNAME) environment variable. - Either C(url) or C(hostname) is required. type: str insecure: description: - A boolean flag that indicates if the server TLS certificate and host name should be checked. type: bool kerberos: description: - A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication. type: bool password: description: - The password of the user. - Default value is set by C(OVIRT_PASSWORD) environment variable. required: true type: str timeout: description: Number of seconds to wait for response. type: int token: description: - Token to be used instead of login with username/password. - Default value is set by C(OVIRT_TOKEN) environment variable. type: str url: description: - A string containing the API URL of the server, usually something like `I(https://server.example.com/ovirt-engine/api)`. - Default value is set by C(OVIRT_URL) environment variable. - Either C(url) or C(hostname) is required. type: str username: description: - The name of the user, something like I(admin@internal). - Default value is set by C(OVIRT_USERNAME) environment variable. required: true type: str type: dict host: description: - 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). type: str name: description: - Name of the Virtual Machine to manage. - If VM don't exists C(name) is required. Otherwise C(id) or C(name) can be used. type: str nics: description: - List of NICs, which should be attached to Virtual Machine. NIC is described by following dictionary. elements: dict suboptions: interface: choices: - virtio - e1000 - rtl8139 default: virtio description: - Type of the network interface. mac_address: description: - Custom MAC address of the network interface, by default it's obtained from MAC pool. - NOTE - 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(pkubica.ovirt.ovirt_nic) module instead. name: description: - Name of the NIC. profile_name: description: - Profile name where NIC should be attached. type: list type: choices: - desktop - server - high_performance description: - Type of the Virtual Machine. - Default value is set by oVirt/RHV engine. - I(high_performance) is supported since Ansible 2.5 and oVirt/RHV 4.2. type: str wait: default: true description: - C(yes) if the module should wait for the entity to get into desired state. type: bool clone: default: 'no' description: - 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. type: bool disks: description: - List of disks, which should be attached to Virtual Machine. Disk is described by following dictionary. elements: dict suboptions: activate: description: - I(True) if the disk should be activated, default is activated. - NOTE - 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(pkubica.ovirt.ovirt_disk) module instead. type: bool bootable: description: - I(True) if the disk should be bootable, default is non bootable. type: bool id: description: - ID of the disk. Either C(name) or C(id) is required. interface: choices: - virtio - ide default: virtio description: - Interface of the disk. name: description: - Name of the disk. Either C(name) or C(id) is required. type: list force: default: 'no' description: - Please check to I(Synopsis) to more detailed description of force parameter, it can behave differently in different situations. type: bool lease: description: - Name of the storage domain this virtual machine lease reside on. Pass an empty string to remove the lease. - NOTE - Supported since oVirt 4.1. type: str state: choices: - absent - next_run - present - registered - running - stopped - suspended - exported - reboot default: present description: - Should the Virtual Machine be running/stopped/present/absent/suspended/next_run/registered/exported/reboot. When C(state) is I(registered) and the unregistered VM's name belongs to an already registered in engine VM in the same DC 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(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. - Please check I(notes) to more detailed description of states. - I(exported) state will export the VM to export domain or as OVA. - I(registered) is supported since 2.4. - I(reboot) is supported since 2.10, virtual machine is rebooted only if it's in up state. type: str cd_iso: description: - ISO file from ISO storage domain which should be attached to Virtual Machine. - If you have multiple ISO disks with the same name use disk ID to specify which should be used or use C(storage_domain) to filter disks. - 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 down the CD will be attached to VM persistently. type: str memory: description: - Amount of memory of the Virtual Machine. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB). - Default value is set by engine. type: str ticket: description: - If I(true), in addition return I(remote_vv_file) inside I(vm) dictionary, which contains compatible content for remote-viewer application. Works only C(state) is I(running). type: bool vmware: description: - Dictionary of values to be used to connect to VMware and import a virtual machine to oVirt. suboptions: drivers_iso: description: - The name of the ISO containing drivers that can be used during the I(virt-v2v) conversion process. password: description: - The password to authenticate against the VMware. sparse: default: true description: - Specifies the disk allocation policy of the resulting virtual machine. I(true) for sparse, I(false) for preallocated. type: bool storage_domain: description: - Specifies the target storage domain for converted disks. This is required parameter. url: description: - 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) username: description: - The username to authenticate against the VMware. type: dict cluster: description: - Name of the cluster, where Virtual Machine should be created. - Required if creating VM. type: str comment: description: - Comment of the Virtual Machine. type: str migrate: description: - If I(true), the VM will migrate to any available host. type: bool sysprep: description: - Dictionary with values for Windows Virtual Machine initialization using sysprep. suboptions: active_directory_ou: description: - Active Directory Organizational Unit, to be used for login of user. custom_script: description: - A custom Sysprep definition in the format of a complete unattended installation answer file. domain: description: - Domain to be set to Windows Virtual Machine. host_name: description: - Hostname to be set to Virtual Machine when deployed. input_locale: description: - Input localization of the Windows Virtual Machine. org_name: description: - Organization name to be set to Windows Virtual Machine. root_password: description: - Password to be set for username to Windows Virtual Machine. system_locale: description: - System localization of the Windows Virtual Machine. timezone: description: - Timezone to be set to Windows Virtual Machine. ui_language: description: - UI language of the Windows Virtual Machine. user_name: description: - Username to be used for set password to Windows Virtual Machine. windows_license_key: description: - License key to be set to Windows Virtual Machine. type: dict timeout: default: 180 description: - The amount of time in seconds the module should wait for the instance to get into desired state. type: int cpu_mode: description: - 'CPU mode of the virtual machine. It can be some of the following: I(host_passthrough), I(host_model) or I(custom).' - For I(host_passthrough) CPU type you need to set C(placement_policy) to I(pinned). - If no value is passed, default value is set by oVirt/RHV engine. type: str next_run: description: - If I(true), the update will not be applied to the VM immediately and will be only applied when virtual machine is restarted. - NOTE - If there are multiple next run configuration changes on the VM, the first change may get reverted if this option is not passed. type: bool quota_id: description: - Virtual Machine quota ID to be used for disk. By default quota is chosen by oVirt/RHV engine. type: str template: description: - Name of the template, which should be used to create Virtual Machine. - Required if creating VM. - If template is not specified and VM doesn't exist, VM will be created from I(Blank) template. type: str timezone: description: - Sets time zone offset of the guest hardware clock. - For example C(Etc/GMT) type: str watchdog: description: - Assign watchdog device for the virtual machine. - 'Watchdogs is a dictionary which can have following values:' suboptions: action: description: - 'Watchdog action to be performed when watchdog is triggered. For example: I(none), I(reset), I(poweroff), I(pause) or I(dump).' model: description: - 'Model of the watchdog device. For example: I(i6300esb), I(diag288) or I(null).' type: dict bios_type: choices: - i440fx_sea_bios - q35_ovmf - q35_sea_bios - q35_secure_boot description: - Set bios type, necessary for some operating systems and secure boot. - If no value is passed, default value is set from cluster. - NOTE - Supported since oVirt 4.3. type: str boot_menu: description: - I(True) enable menu to select boot device, I(False) to disable it. By default is chosen by oVirt/RHV engine. type: bool cpu_cores: description: - Number of virtual CPUs cores of the Virtual Machine. - Default value is set by oVirt/RHV engine. type: int exclusive: description: - When C(state) is I(exported) this parameter indicates if the existing VM with the same name should be overwritten. type: bool stateless: description: - If I(yes) Virtual Machine will be set 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. type: bool cloud_init: description: - Dictionary with values for Unix-like Virtual Machine initialization using cloud init. suboptions: authorized_ssh_keys: description: - Use this SSH keys to login to Virtual Machine. custom_script: description: - Cloud-init script which will be executed on Virtual Machine when deployed. - This is appended to the end of the cloud-init script generated by any other options. - For further information, refer to cloud-init User-Data documentation. dns_search: description: - DNS search domains to be configured on Virtual Machine. dns_servers: description: - DNS servers to be configured on Virtual Machine, maximum of two, space-separated. host_name: description: - Hostname to be set to Virtual Machine when deployed. nic_boot_protocol: choices: - none - dhcp - static description: - Set boot protocol of the network interface of Virtual Machine. nic_boot_protocol_v6: choices: - none - dhcp - static description: - Set boot protocol of the network interface of Virtual Machine. nic_gateway: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. nic_gateway_v6: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. - For IPv6 addresses the value is an integer in the range of 0-128, which represents the subnet prefix. nic_ip_address: description: - If boot protocol is static, set this IP address to network interface of Virtual Machine. nic_ip_address_v6: description: - If boot protocol is static, set this IP address to network interface of Virtual Machine. nic_name: description: - Set name to network interface of Virtual Machine. nic_netmask: description: - If boot protocol is static, set this netmask to network interface of Virtual Machine. nic_netmask_v6: description: - If boot protocol is static, set this netmask to network interface of Virtual Machine. regenerate_ssh_keys: description: - If I(True) SSH keys will be regenerated on Virtual Machine. type: bool root_password: description: - Password to be set for user specified by C(user_name) parameter. timezone: description: - Timezone to be set to Virtual Machine when deployed. user_name: description: - Username to be used to set password to Virtual Machine when deployed. type: dict cpu_shares: description: - Set a CPU shares for this Virtual Machine. - Default value is set by oVirt/RHV engine. type: int export_ova: description: - Dictionary of values to be used to export VM as OVA. suboptions: directory: description: - The name of the directory where the OVA has to be exported. filename: description: - The name of the exported OVA file. host: description: - The name of the destination host where the OVA has to be exported. type: dict io_threads: description: - Number of IO threads used by virtual machine. I(0) means IO threading disabled. type: int memory_max: description: - Upper bound of virtual machine memory up to which memory hot-plug can be performed. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB). - Default value is set by engine. type: str numa_nodes: description: - List of vNUMA Nodes to set for this VM and pin them to assigned host's physical NUMA node. - 'Each vNUMA node is described by following dictionary:' elements: dict suboptions: cores: description: - List of VM CPU cores indexes to be included in this NUMA node. required: true type: list index: description: - The index of this NUMA node. required: true memory: description: - Memory size of the NUMA node in MiB. required: true numa_node_pins: description: - List of physical NUMA node indexes to pin this virtual NUMA node to. type: list type: list rng_device: description: - Random number generator (RNG). You can choose of one the following devices I(urandom), I(random) or I(hwrng). - In order to select I(hwrng), you must have it enabled on cluster first. - /dev/urandom is used for cluster version >= 4.1, and /dev/random for cluster version <= 4.0 type: str cpu_pinning: description: - CPU Pinning topology to map virtual machine CPU to host CPU. - 'CPU Pinning topology is a list of dictionary which can have following values:' elements: dict suboptions: cpu: description: - Number of the host CPU. vcpu: description: - Number of the virtual machine CPU. type: list cpu_sockets: description: - Number of virtual CPUs sockets of the Virtual Machine. - Default value is set by oVirt/RHV engine. type: int cpu_threads: description: - Number of threads per core of the Virtual Machine. - Default value is set by oVirt/RHV engine. type: int description: description: - Description of the Virtual Machine. type: str disk_format: choices: - cow - raw default: cow description: - Specify format of the disk. - 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 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. - This parameter is considered only when C(template) and C(storage domain) is provided. type: str initrd_path: description: - 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. type: str kernel_path: description: - 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. type: str snapshot_vm: description: - Source VM to clone VM from. - VM should have snapshot specified by C(snapshot). - If C(snapshot_name) specified C(snapshot_vm) is required. type: str usb_support: description: - I(True) enable USB support, I(False) to disable it. By default is chosen by oVirt/RHV engine. type: bool boot_devices: choices: - cdrom - hd - network description: - List of boot devices which should be used to boot. For example C([ cdrom, hd ]). - Default value is set by oVirt/RHV engine. elements: str type: list fetch_nested: description: - If I(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 C(nested_attributes). type: bool host_devices: description: - Single Root I/O Virtualization - technology that allows single device to expose multiple endpoints that can be passed to VMs - host_devices is an list which contain dictionary with name and state of device elements: dict type: list lun_mappings: description: - 'Mapper which maps lun between VM''s OVF and the destination lun this VM should contain, relevant when C(state) is registered. lun_mappings is described by the following dictionary:' elements: dict suboptions: logical_unit_address: description: - The address of the block storage host. logical_unit_id: description: - The logical unit number to identify a logical unit, logical_unit_password): description: - Password to be used to connect to the block storage host. logical_unit_port: description: - The port being used to connect with the LUN disk. logical_unit_portal: description: - The portal being used to connect with the LUN disk. logical_unit_target: description: - The iSCSI specification located on an iSCSI server logical_unit_username: description: - Username to be used to connect to the block storage host. storage_type: description: - The storage type which the LUN reside on (iscsi or fcp)" type: list export_domain: description: - When C(state) is I(exported)this parameter specifies the name of the export storage domain. type: str force_migrate: description: - If I(true), the VM will migrate when I(placement_policy=user-migratable) but not when I(placement_policy=pinned). type: bool instance_type: description: - Name of virtual machine's hardware configuration. - By default no instance type is used. type: str kernel_params: description: - Kernel command line parameters (formatted as string) to be used with the kernel specified by C(kernel_path) option. type: str poll_interval: default: 3 description: - Number of the seconds the module waits until another poll request on entity status is sent. type: int role_mappings: description: - 'Mapper which maps role name between VM''s OVF and the destination role this VM should be registered to, relevant when C(state) is registered. Role mapping is described by the following dictionary:' elements: dict suboptions: dest_name: description: - The name of the destination role. source_name: description: - The name of the source role. type: list serial_policy: choices: - vm - host - custom description: - Specify a serial number policy for the Virtual Machine. - Following options are supported. - 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(custom) - Allows you to specify a custom serial number in C(serial_policy_value). type: str snapshot_name: description: - Snapshot to clone VM from. - Snapshot with description specified should exist. - You have to specify C(snapshot_vm) parameter with virtual machine name of this snapshot. type: str numa_tune_mode: choices: - interleave - preferred - strict description: - Set how the memory allocation for NUMA nodes of this VM is applied (relevant if NUMA nodes are set for this VM). - 'It can be one of the following: I(interleave), I(preferred) or I(strict).' - If no value is passed, default value is set by oVirt/RHV engine. type: str serial_console: description: - I(True) enable VirtIO serial console, I(False) to disable it. By default is chosen by oVirt/RHV engine. type: bool storage_domain: description: - Name of the storage domain where all template disks should be created. - This parameter is considered only when C(template) is provided. - IMPORTANT - This parameter is not idempotent, if the VM exists and you specify different storage domain, disk won't move. type: str cloud_init_nics: description: - List of dictionaries representing network interfaces to be setup by 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 are merged with C(cloud_init_nics) parameters. elements: dict suboptions: nic_boot_protocol: description: - Set boot protocol of the network interface of Virtual Machine. Can be one of C(none), C(dhcp) or C(static). nic_boot_protocol_v6: description: - Set boot protocol of the network interface of Virtual Machine. Can be one of C(none), C(dhcp) or C(static). nic_gateway: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. nic_gateway_v6: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. - For IPv6 addresses the value is an integer in the range of 0-128, which represents the subnet prefix. nic_ip_address: description: - If boot protocol is static, set this IP address to network interface of Virtual Machine. nic_ip_address_v6: description: - If boot protocol is static, set this IP address to network interface of Virtual Machine. nic_name: description: - Set name to network interface of Virtual Machine. nic_netmask: description: - If boot protocol is static, set this netmask to network interface of Virtual Machine. nic_netmask_v6: description: - If boot protocol is static, set this netmask to network interface of Virtual Machine. type: list domain_mappings: description: - 'Mapper which maps aaa domain name between VM''s OVF and the destination aaa domain this VM should be registered to, relevant when C(state) is registered. The aaa domain mapping is described by the following dictionary:' elements: dict suboptions: dest_name: description: - The name of the destination aaa domain. source_name: description: - The name of the source aaa domain. type: list cluster_mappings: description: - 'Mapper which maps cluster name between VM''s OVF and the destination cluster this VM should be registered to, relevant when C(state) is registered. Cluster mapping is described by the following dictionary:' elements: dict suboptions: dest_name: description: - The name of the destination cluster. source_name: description: - The name of the source cluster. type: list delete_protected: description: - If I(yes) Virtual Machine will 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. type: bool operating_system: description: - Operating system of the Virtual Machine, for example 'rhel_8x64'. - Default value is set by oVirt/RHV engine. - Use the M(pkubica.ovirt.ovirt_vm_os_info) module to obtain the current list. type: str placement_policy: description: - The configuration of the virtual machine's placement policy. - If no value is passed, default value is set by oVirt/RHV engine. - 'Placement policy can be one of the following values:' suboptions: migratable: description: - Allow manual and automatic migration. pinned: description: - Do not allow migration. user_migratable: description: - Allow manual migration only. type: str template_version: description: - Version number of the template to be used for VM. - By default the latest available version of the template is used. type: int clone_permissions: default: 'no' description: - 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. - This parameter is used only when C(state) is I(running) or I(present) and VM didn't exist before. type: bool custom_properties: description: - Properties sent to VDSM to configure various hooks. - 'Custom properties is a list of dictionary which can have following values:' elements: dict suboptions: name: description: - 'Name of the custom property. For example: I(hugepages), I(vhost), I(sap_agent), etc.' regexp: description: - Regular expression to set for custom property. value: description: - Value to set for custom property. type: list graphical_console: description: - Assign graphical console to the virtual machine. suboptions: disconnect_action: description: - 'Returns the action that will take place when the graphic console(SPICE only) is disconnected. The options are:' - I(none) No action is taken. - I(lock_screen) Locks the currently active user session. - I(logout) Logs out the currently active user session. - I(reboot) Initiates a graceful virtual machine reboot. - I(shutdown) Initiates a graceful virtual machine shutdown. type: str headless_mode: description: - If I(true) disable the graphics console for this virtual machine. type: bool keyboard_layout: description: - The keyboard layout to use with this graphic console. - This option is only available for the VNC console type. - If no keyboard is enabled then it won't be reported. type: str monitors: description: - The number of monitors opened for this graphic console. - This option is only available for the SPICE protocol. - Possible values are 1, 2 or 4. type: int protocol: description: - Graphical protocol, a list of I(spice), I(vnc), or both. elements: str type: list type: dict high_availability: description: - If I(yes) Virtual Machine will 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. type: bool memory_guaranteed: description: - Amount of minimal guaranteed memory of the Virtual Machine. 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. type: str nested_attributes: description: - Specifies list of the attributes which should be fetched from the API. - This parameter apply only when C(fetch_nested) is I(true). elements: str type: list reassign_bad_macs: description: - Boolean indication whether to reassign bad macs when C(state) is registered. type: bool smartcard_enabled: description: - If I(true), use smart card authentication. type: bool soundcard_enabled: description: - If I(true), the sound card is added to the virtual machine. type: bool ballooning_enabled: description: - If I(true), use memory ballooning. - Memory balloon is a guest device, which may be used to re-distribute / reclaim the host memory based on VM needs in a dynamic way. In this way it's possible to create memory over commitment states. type: bool cloud_init_persist: aliases: - sysprep_persist default: 'no' description: - If I(yes) the C(cloud_init) or C(sysprep) parameters will be saved for the virtual machine and the virtual machine won't be started as run-once. type: bool serial_policy_value: description: - Allows you to specify a custom serial number. - This parameter is used only when C(serial_policy) is I(custom). type: str allow_partial_import: description: - Boolean indication whether to allow partial registration of Virtual Machine when C(state) is registered. type: bool kernel_params_persist: description: - If I(true) C(kernel_params), C(initrd_path) and C(kernel_path) will persist in virtual machine configuration, if I(False) it will be used for run once. type: bool vnic_profile_mappings: description: - 'Mapper which maps an external virtual NIC profile to one that exists in the engine when C(state) is registered. vnic_profile is described by the following dictionary:' elements: dict suboptions: source_network_name: description: - The network name of the source network. source_profile_name: description: - The profile name related to the source network. target_profile_id: description: - The id of the target profile id to be mapped to in the engine. type: list affinity_group_mappings: description: - Mapper which maps affinity name between VM's OVF and the destination affinity this VM should be registered to, relevant when C(state) is registered. elements: dict type: list affinity_label_mappings: description: - Mapper which maps affinity label name between VM's OVF and the destination label this VM should be registered to, relevant when C(state) is registered. elements: dict type: list custom_emulated_machine: description: - Sets the value of the custom_emulated_machine attribute. type: str high_availability_priority: description: - Indicates the priority of the virtual machine inside the run and migration queues. Virtual machines with higher priorities will be started and migrated before virtual machines with lower priorities. The value is an integer between 0 and 100. The higher the value, the higher the priority. - If no value is passed, default value is set by oVirt/RHV engine. type: int use_latest_template_version: description: - Specify if latest template version should be used, when running a stateless VM. - If this parameter is set to I(yes) stateless VM is created. type: bool custom_compatibility_version: description: - Enables a virtual machine to be customized to its own compatibility version. If 'C(custom_compatibility_version)' is set, it overrides the cluster's compatibility version for this particular virtual machine. type: str
id: description: ID of the VM which is managed returned: On success if VM is found. sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c type: str vm: description: 'Dictionary of all the VM attributes. VM attributes can be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/vm. Additionally when user sent ticket=true, this module will return also remote_vv_file parameter in vm dictionary, which contains remote-viewer compatible file to open virtual machine console. Please note that this file contains sensible information.' returned: On success if VM is found. type: dict