ovirt.ovirt_collection.ovirt_instance_type (1.0.2) — module

Module to manage Instance Types in oVirt/RHV

| "added in version" 1.0.0 of ovirt.ovirt_collection"

Authors: Martin Necas (@mnecas), Ondra Machacek (@machacekondra)

preview | supported by community

Install collection

Install with ansible-galaxy collection install ovirt.ovirt_collection:==1.0.2


Add to requirements.yml

  collections:
    - name: ovirt.ovirt_collection
      version: 1.0.2

Description

This module manages whole lifecycle of the Instance Type in oVirt/RHV.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Examples don't contain auth parameter for simplicity,
# look at ovirt_auth module to see how to reuse authentication:

# Create instance type
- name: Create instance type
  ovirt_instance_type:
    state: present
    name: myit
    rng_device: hwrng
    rng_bytes: 200
    rng_period: 200
    soundcard_enabled: true
    virtio_scsi: true
    boot_devices:
      - network
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove instance type
- ovirt_instance_type:
    state: absent
    name: myit
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Create instance type with predefined memory and cpu limits.
- ovirt_instance_type:
    state: present
    name: myit
    memory: 2GiB
    cpu_cores: 2
    cpu_sockets: 2
    nics:
      - name: nic1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Enable usb support and serial console
- ovirt_instance_type:
    name: myit
    usb_support: True
    serial_console: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Use graphical console with spice and vnc
- name: Create a instance type that has the console configured for both Spice and VNC
  ovirt_instance_type:
    name: myit
    graphical_console:
      protocol:
        - spice
        - vnc

Inputs

    
id:
    description:
    - ID of the Instance Type to manage.

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
      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
      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 Instance Type 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).

name:
    description:
    - Name of the Instance Type to manage.
    - If instance type don't exists C(name) is required. Otherwise C(id) or C(name) can
      be used.

nics:
    description:
    - List of NICs, which should be attached to Virtual Machine. NIC is described by following
      dictionary.
    - C(name) - Name of the NIC.
    - 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(mac_address) - 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 instance type in more depth please
      use M(ovirt_nic) module instead.

wait:
    default: true
    description:
    - C(yes) if the module should wait for the entity to get into desired state.
    type: bool

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Should the Instance Type be present/absent.
    - I(present) state will create/update instance type and don't change its state if
      it already exists.

memory:
    description:
    - Amount of memory of the Instance Type. Prefix uses IEC 60027-2 standard (for example
      1GiB, 1024MiB).
    - Default value is set by engine.

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 instance type. 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.

watchdog:
    description:
    - Assign watchdog device for the instance type.
    - 'Watchdogs is a dictionary which can have following values:'
    - 'C(model) - Model of the watchdog device. For example: I(i6300esb), I(diag288) or
      I(null).'
    - 'C(action) - Watchdog action to be performed when watchdog is triggered. For example:
      I(none), I(reset), I(poweroff), I(pause) or I(dump).'

cpu_cores:
    description:
    - Number of virtual CPUs cores of the Instance Type.
    - Default value is set by oVirt/RHV engine.

rng_bytes:
    description:
    - Number of bytes allowed to consume per period.

io_threads:
    description:
    - Number of IO threads used by instance type. I(0) means IO threading disabled.

memory_max:
    description:
    - Upper bound of instance type 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.

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

rng_period:
    description:
    - Duration of one period in milliseconds.

cpu_pinning:
    description:
    - CPU Pinning topology to map instance type CPU to host CPU.
    - 'CPU Pinning topology is a list of dictionary which can have following values:'
    - C(cpu) - Number of the host CPU.
    - C(vcpu) - Number of the instance type CPU.

cpu_sockets:
    description:
    - Number of virtual CPUs sockets of the Instance Type.
    - Default value is set by oVirt/RHV engine.

cpu_threads:
    description:
    - Number of virtual CPUs sockets of the Instance Type.
    - Default value is set by oVirt/RHV engine.

description:
    description:
    - Description of the instance type.

usb_support:
    description:
    - I(True) enable USB support, I(False) to disable it. By default is chosen by oVirt/RHV
      engine.
    type: bool

virtio_scsi:
    description:
    - If I(true), virtio scsi will be enabled.
    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.

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

poll_interval:
    default: 3
    description:
    - Number of the seconds the module waits until another poll request on entity status
      is sent.
    type: int

serial_console:
    description:
    - I(True) enable VirtIO serial console, I(False) to disable it. By default is chosen
      by oVirt/RHV engine.
    type: bool

operating_system:
    description:
    - Operating system of the Instance Type.
    - Default value is set by oVirt/RHV engine.
    - 'Possible values: 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'

placement_policy:
    description:
    - The configuration of the instance type's placement policy.
    - 'Placement policy can be one of the following values:'
    - C(migratable) - Allow manual and automatic migration.
    - C(pinned) - Do not allow migration.
    - C(user_migratable) - Allow manual migration only.
    - If no value is passed, default value is set by oVirt/RHV engine.

graphical_console:
    description:
    - Assign graphical console to the instance type.
    - 'Graphical console is a dictionary which can have following values:'
    - C(headless_mode) - If I(true) disable the graphics console for this instance type.
    - C(protocol) - Graphical protocol, a list of I(spice), I(vnc), or both.

high_availability:
    description:
    - If I(yes) Instance Type will be set as highly available.
    - If I(no) Instance Type 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 Instance Type. 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.

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).
    type: list

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 instance type.
    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 instance type needs in a dynamic way. In this way it's possible
      to create memory over commitment states.
    type: bool

high_availability_priority:
    description:
    - Indicates the priority of the instance type inside the run and migration queues.
      Instance Type with higher priorities will be started and migrated before instance
      types 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.

Outputs

id:
  description: ID of the instance type which is managed
  returned: On success if instance type is found.
  sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c
  type: str
instancetype:
  description: 'Dictionary of all the instance type attributes. instance type attributes
    can be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/instance_type.'
  returned: On success if instance type is found.
  type: dict