community.general.rhevm module – RHEV/oVirt automation
Note
This module is part of the community.general collection (version 11.4.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.rhevm.
Synopsis
- This module only supports oVirt/RHEV version 3. 
- A newer module ovirt.ovirt.ovirt_vm supports oVirt/RHV version 4. 
- Allows you to create/remove/update or powermanage virtual machines on a RHEV/oVirt platform. 
Requirements
The below requirements are needed on the host that executes this module.
- ovirtsdk 
Parameters
| Parameter | Comments | 
|---|---|
| This option uses complex arguments and is a list of items that specify the bootorder. Default:  | |
| The CD you wish to have mounted on the VM when  | |
| The RHEV/oVirt cluster in which you want you VM to start. Default:  | |
| This parameter is used to configure the CPU share. Default:  | |
| The RHEV/oVirt datacenter in which you want you VM to start. Default:  | |
| This option sets the delete protection checkbox. Choices: 
 | |
| This option uses complex arguments and is a list of disks with the options  | |
| This option uses complex arguments and is a list of interfaces with the options  | |
| The template to use for the VM. | |
| A boolean switch to make a secure or insecure connection to the server. Choices: 
 | |
| The minimum amount of memory you wish to reserve for this system. Default:  | |
| The name of the VM. | |
| The operating system option in RHEV/oVirt. Default:  | |
| The password for user authentication. | |
| The port on which the API is reachable. Default:  | |
| The name/IP of your RHEV-m/oVirt instance. Default:  | |
| This serves to create/remove/update or powermanage your VM. Choices: 
 | |
| The timeout you wish to define for power actions. When  When  When  | |
| To define if the VM is a server or desktop. Choices: 
 | |
| The user to authenticate with. Default:  | |
| To make your VM High Available. Choices: 
 | |
| The number of CPUs you want in your VM. Default:  | |
| The host you wish your VM to run on. | |
| The amount of memory you want your VM to use (in GB). Default:  | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Support: none | Can run in  | |
| Support: none | Returns details on what has changed (or possibly needs changing in  | 
Examples
- name: Basic get info from VM
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: demo
    state: info
- name: Basic create example from image
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: demo
    cluster: centos
    image: centos7_x64
    state: present
- name: Power management
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    cluster: RH
    name: uptime_server
    image: centos7_x64
    state: down
- name: Multi disk, multi nic create example
  community.general.rhevm:
    server: rhevm01
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    cluster: RH
    name: server007
    type: server
    vmcpu: 4
    vmmem: 2
    ifaces:
      - name: eth0
        vlan: vlan2202
      - name: eth1
        vlan: vlan36
      - name: eth2
        vlan: vlan38
      - name: eth3
        vlan: vlan2202
    disks:
      - name: root
        size: 10
        domain: ssd-san
      - name: swap
        size: 10
        domain: 15kiscsi-san
      - name: opt
        size: 10
        domain: 15kiscsi-san
      - name: var
        size: 10
        domain: 10kiscsi-san
      - name: home
        size: 10
        domain: sata-san
    boot_order:
      - network
      - hd
    state: present
- name: Add a CD to the disk cd_drive
  community.general.rhevm:
    user: '{{ rhev.admin.name }}'
    password: '{{ rhev.admin.pass }}'
    name: server007
    cd_drive: rhev-tools-setup.iso
    state: cd
- name: New host deployment + host network configuration
  community.general.rhevm:
    password: '{{ rhevm.admin.pass }}'
    name: ovirt_node007
    type: host
    cluster: rhevm01
    ifaces:
      - name: em1
      - name: em2
      - name: p3p1
        ip: 172.31.224.200
        netmask: 255.255.254.0
      - name: p3p2
        ip: 172.31.225.200
        netmask: 255.255.254.0
      - name: bond0
        bond:
          - em1
          - em2
        network: rhevm
        ip: 172.31.222.200
        netmask: 255.255.255.0
        management: true
      - name: bond0.36
        network: vlan36
        ip: 10.2.36.200
        netmask: 255.255.254.0
        gateway: 10.2.36.254
      - name: bond0.2202
        network: vlan2202
      - name: bond0.38
        network: vlan38
    state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| Returns all of the VMs variables and execution. Returned: always Sample:  | 
