ansible / ansible.builtin / v2.9.26 / module / rhevm RHEV/oVirt automation | "added in version" 2.2 of ansible.builtin" Authors: Timothy Vandenbrande (@TimothyVandenbrande) preview | supported by communityansible.builtin.rhevm (v2.9.26) — module
pip
Install with pip install ansible==2.9.26
This module only supports oVirt/RHEV version 3.
A newer module M(ovirt_vm) supports oVirt/RHV version 4.
Allows you to create/remove/update or powermanage virtual machines on a RHEV/oVirt platform.
- name: Basic get info from VM rhevm: server: rhevm01 user: '{{ rhev.admin.name }}' password: '{{ rhev.admin.pass }}' name: demo state: info
- name: Basic create example from image rhevm: server: rhevm01 user: '{{ rhev.admin.name }}' password: '{{ rhev.admin.pass }}' name: demo cluster: centos image: centos7_x64 state: present
- name: Power management 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 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 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 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: yes - 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
name: description: - The name of the VM. type: str port: default: 443 description: - The port on which the API is reachable. type: int type: choices: - desktop - host - server default: server description: - To define if the VM is a server or desktop. type: str user: default: admin@internal description: - The user to authenticate with. type: str disks: description: - This option uses complex arguments and is a list of disks with the options name, size and domain. type: list image: description: - The template to use for the VM. type: str osver: default: rhel_6x64 description: - The operating system option in RHEV/oVirt. type: str state: choices: - absent - cd - down - info - ping - present - restarted - up default: present description: - This serves to create/remove/update or powermanage your VM. type: str vm_ha: default: true description: - To make your VM High Available. type: bool vmcpu: default: 2 description: - The number of CPUs you want in your VM. type: int vmmem: default: 1 description: - The amount of memory you want your VM to use (in GB). type: int ifaces: aliases: - interfaces - nics description: - This option uses complex arguments and is a list of interfaces with the options name and vlan. type: list mempol: default: 1 description: - The minimum amount of memory you wish to reserve for this system. type: int server: default: 127.0.0.1 description: - The name/IP of your RHEV-m/oVirt instance. type: str vmhost: description: - The host you wish your VM to run on. type: str cluster: description: - The RHEV/oVirt cluster in which you want you VM to start. type: str timeout: description: - The timeout you wish to define for power actions. - When I(state = 'up'). - When I(state = 'down'). - When I(state = 'restarted'). type: int cd_drive: description: - The CD you wish to have mounted on the VM when I(state = 'CD'). type: str del_prot: default: true description: - This option sets the delete protection checkbox. type: bool password: description: - The password for user authentication. type: str cpu_share: default: 0 description: - This parameter is used to configure the CPU share. type: int boot_order: default: - hd - network description: - This option uses complex arguments and is a list of items that specify the bootorder. type: list datacenter: default: Default description: - The RHEV/oVirt datacenter in which you want you VM to start. type: str insecure_api: default: false description: - A boolean switch to make a secure or insecure connection to the server. type: bool
vm: description: Returns all of the VMs variables and execution. returned: always sample: '{ "boot_order": [ "hd", "network" ], "changed": true, "changes": [ "Delete Protection" ], "cluster": "C1", "cpu_share": "0", "created": false, "datacenter": "Default", "del_prot": true, "disks": [ { "domain": "ssd-san", "name": "OS", "size": 40 } ], "eth0": "00:00:5E:00:53:00", "eth1": "00:00:5E:00:53:01", "eth2": "00:00:5E:00:53:02", "exists": true, "failed": false, "ifaces": [ { "name": "eth0", "vlan": "Management" }, { "name": "eth1", "vlan": "Internal" }, { "name": "eth2", "vlan": "External" } ], "image": false, "mempol": "0", "msg": [ "VM exists", "cpu_share was already set to 0", "VM high availability was already set to True", "The boot order has already been set", "VM delete protection has been set to True", "Disk web2_Disk0_OS already exists", "The VM starting host was already set to host416" ], "name": "web2", "type": "server", "uuid": "4ba5a1be-e60b-4368-9533-920f156c817b", "vm_ha": true, "vmcpu": "4", "vmhost": "host416", "vmmem": "16" }' type: dict