ovirt.ovirt_collection.ovirt_host (1.0.2) — module

Module to manage hosts in oVirt/RHV

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

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

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

Module to manage hosts 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:

# Add host with username/password supporting SR-IOV.
# Note that override_iptables is false by default in oVirt/RHV:
- ovirt_host:
    cluster: Default
    name: myhost
    address: 10.34.61.145
    password: secret
    override_iptables: true
    kernel_params:
      - intel_iommu=on
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add host using public key
- ovirt_host:
    public_key: true
    cluster: Default
    name: myhost2
    address: 10.34.61.145
    override_iptables: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Deploy hosted engine host
- ovirt_host:
    cluster: Default
    name: myhost2
    password: secret
    address: 10.34.61.145
    override_iptables: true
    hosted_engine: deploy
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Maintenance
- ovirt_host:
    state: maintenance
    name: myhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Restart host using power management:
- ovirt_host:
    state: restarted
    name: myhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Upgrade host
- ovirt_host:
    state: upgraded
    name: myhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# discover iscsi targets
- ovirt_host:
    state: iscsidiscover
    name: myhost
    iscsi:
      username: iscsi_user
      password: secret
      address: 10.34.61.145
      port: 3260
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# login to iscsi targets
- ovirt_host:
    state: iscsilogin
    name: myhost
    iscsi:
      username: iscsi_user
      password: secret
      address: 10.34.61.145
      target: "iqn.2015-07.com.mlipchuk2.redhat:444"
      port: 3260
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Reinstall host using public key
- ovirt_host:
    state: reinstalled
    name: myhost
    public_key: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove host
- ovirt_host:
    state: absent
    name: myhost
    force: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Retry removing host when failed (https://bugzilla.redhat.com/show_bug.cgi?id=1719271)
- ovirt_host:
    state: absent
    name: myhost
  register: result
  until: not result.failed
  retries: 6
  delay: 20
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Change host Name
- ovirt_host:
    id: 00000000-0000-0000-0000-000000000000
    name: "new host name"

Inputs

    
id:
    description:
    - ID of the host 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

name:
    description:
    - Name of the host to manage.
    required: true

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

force:
    default: false
    description:
    - Indicates that the host should be removed even if it is non-responsive, or if it
      is part of a Gluster Storage cluster and has volume bricks on it.
    - 'WARNING: It doesn''t forcibly remove the host if another host related operation
      is being executed on the host at the same time.'
    type: bool

iscsi:
    description:
    - If C(state) is I(iscsidiscover) it means that the iscsi attribute is being used
      to discover targets
    - If C(state) is I(iscsilogin) it means that the iscsi attribute is being used to
      login to the specified targets passed as part of the iscsi attribute
    suboptions:
      address:
        description:
        - Address of the iSCSI storage server.
      password:
        description:
        - A CHAP password for logging into a target.
      port:
        description:
        - The port being used to connect with iscsi.
      portal:
        description:
        - The portal being used to connect with iscsi.
      target:
        description:
        - The target IQN for the storage device.
      username:
        description:
        - A CHAP user name for logging into a target.

state:
    choices:
    - present
    - absent
    - maintenance
    - upgraded
    - started
    - restarted
    - stopped
    - reinstalled
    - iscsidiscover
    - iscsilogin
    default: present
    description:
    - State which should a host to be in after successful completion.
    - I(iscsilogin) and I(iscsidiscover) are supported since version 2.4.

address:
    description:
    - Host address. It can be either FQDN (preferred) or IP address.

cluster:
    description:
    - Name of the cluster, where host should be created.

comment:
    description:
    - Description of the host.

timeout:
    default: 600
    description:
    - The amount of time in seconds the module should wait for the host to get into desired
      state.
    type: int

activate:
    default: true
    description:
    - If C(state) is I(present) activate the host.
    - This parameter is good to disable, when you don't want to change the state of host
      when using I(present) C(state).
    type: bool

password:
    description:
    - Password of the root. It's required in case C(public_key) is set to I(False).

public_key:
    aliases:
    - ssh_public_key
    default: false
    description:
    - I(True) if the public key should be used to authenticate to host.
    - It's required in case C(password) is not set.
    type: bool

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

spm_priority:
    description:
    - SPM priority of the host. Integer value from 1 to 10, where higher number means
      higher priority.

check_upgrade:
    default: true
    description:
    - If I(true) and C(state) is I(upgraded) run check for upgrade action before executing
      upgrade action.
    type: bool

hosted_engine:
    choices:
    - deploy
    - undeploy
    description:
    - If I(deploy) it means this host should deploy also hosted engine components.
    - If I(undeploy) it means this host should un-deploy hosted engine components and
      this host will not function as part of the High Availability cluster.

kernel_params:
    description:
    - List of kernel boot parameters.
    - 'Following are most common kernel parameters used for host:'
    - 'Hostdev Passthrough & SR-IOV: intel_iommu=on'
    - 'Nested Virtualization: kvm-intel.nested=1'
    - 'Unsafe Interrupts: vfio_iommu_type1.allow_unsafe_interrupts=1'
    - 'PCI Reallocation: pci=realloc'
    - C(Note:)
    - Modifying kernel boot parameters settings can lead to a host boot failure. Please
      consult the product documentation before doing any changes.
    - Kernel boot parameters changes require host deploy and restart. The host needs to
      be I(reinstalled) successfully and then to be I(rebooted) for kernel boot parameters
      to be applied.

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

vgpu_placement:
    choices:
    - consolidated
    - separated
    description:
    - If I(consolidated), each vGPU is placed on the first physical card with available
      space. This is the default placement, utilizing all available space on the physical
      cards.
    - If I(separated), each vGPU is placed on a separate physical card, if possible. This
      can be useful for improving vGPU performance.

override_display:
    description:
    - Override the display address of all VMs on this host with specified address.
    type: bool

kdump_integration:
    choices:
    - enabled
    - disabled
    description:
    - Specify if host will have enabled Kdump integration.

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

override_iptables:
    description:
    - If True host iptables will be overridden by host deploy script.
    - Note that C(override_iptables) is I(false) by default in oVirt/RHV.
    type: bool

reboot_after_upgrade:
    default: true
    description:
    - If I(true) and C(state) is I(upgraded) reboot host after successful upgrade.
    type: bool

power_management_enabled:
    description:
    - Enable or disable power management of the host.
    - For more comprehensive setup of PM use C(ovirt_host_pm) module.
    type: bool

Outputs

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