W3cubDocs

/Ansible

ovirt_hosts - Module to manage hosts in oVirt/RHV

New in version 2.3.

Synopsis

  • Module to manage hosts in oVirt/RHV

Requirements (on host that executes module)

  • python >= 2.7
  • ovirt-engine-sdk-python >= 4.0.0

Options

parameter required default choices comments
activate
(added in 2.4)
no True
If state is present activate the host.
This parameter is good to disable, when you don't want to change the state of host when using present state.
address
no
Host address. It can be either FQDN (preferred) or IP address.
auth
yes
Dictionary with values needed to create HTTP/HTTPS connection to oVirt:
username[required] - The name of the user, something like admin@internal. Default value is set by OVIRT_USERNAME environment variable.
password[required] - The password of the user. Default value is set by OVIRT_PASSWORD environment variable.
url[required] - A string containing the base URL of the server, usually something like `https://server.example.com/ovirt-engine/api`. Default value is set by OVIRT_URL environment variable.
token - Token to be used instead of login with username/password. Default value is set by OVIRT_TOKEN environment variable.
insecure - A boolean flag that indicates if the server TLS certificate and host name should be checked.
ca_file - A PEM file containing the trusted CA certificates. The certificate presented by the server will be verified using these CA certificates. If `ca_file` parameter is not set, system wide CA certificate store is used. Default value is set by OVIRT_CAFILE environment variable.
kerberos - A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication.
headers - Dictionary of HTTP headers to be added to each API call.
check_upgrade
(added in 2.4)
no True
If true and state is upgraded run check for upgrade action before executing upgrade action.
cluster
no
Name of the cluster, where host should be created.
comment
no
Description of the host.
fetch_nested
(added in 2.3)
no
If 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 nested_attributes.
force
no
If True host will be forcibly moved to desired state.
hosted_engine
no
If deploy it means this host should deploy also hosted engine components.
If undeploy it means this host should un-deploy hosted engine components and this host will not function as part of the High Availability cluster.
iscsi
(added in 2.4)
no
If state is iscsidiscover it means that the iscsi attribute is being used to discover targets
If state is iscsilogin it means that the iscsi attribute is being used to login to the specified targets passed as part of the iscsi attribute
kdump_integration
no enabled
  • enabled
  • disabled
Specify if host will have enabled Kdump integration.
kernel_params
no
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
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 reinstalled suceesfully and then to be rebooted for kernel boot parameters to be applied.
name
yes
Name of the host to manage.
nested_attributes
(added in 2.3)
no
Specifies list of the attributes which should be fetched from the API.
This parameter apply only when fetch_nested is true.
override_display
no
Override the display address of all VMs on this host with specified address.
override_iptables
no
If True host iptables will be overridden by host deploy script.
Note that override_iptables is false by default in oVirt/RHV.
password
no
Password of the root. It's required in case public_key is set to False.
poll_interval
no 3
Number of the seconds the module waits until another poll request on entity status is sent.
power_management_enabled
(added in 2.4)
no
Enable or disable power management of the host.
For more comprehensive setup of PM use ovirt_host_pm module.
public_key
no
True if the public key should be used to authenticate to host.
It's required in case password is not set.
aliases: ssh_public_key
spm_priority
no
SPM priority of the host. Integer value from 1 to 10, where higher number means higher priority.
state
no present
  • present
  • absent
  • maintenance
  • upgraded
  • started
  • restarted
  • stopped
  • reinstalled
  • iscsidiscover
  • iscsilogin
State which should a host to be in after successful completion.
iscsilogin and iscsidiscover are supported since version 2.4.
timeout
no 180
The amount of time in seconds the module should wait for the instance to get into desired state.
wait
no
True if the module should wait for the entity to get into desired state.

Examples

# 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_hosts:
    cluster: Default
    name: myhost
    address: 10.34.61.145
    password: secret
    override_iptables: true
    kernel_params:
      - intel_iommu=on

# Add host using public key
- ovirt_hosts:
    public_key: true
    cluster: Default
    name: myhost2
    address: 10.34.61.145
    override_iptables: true

# Deploy hosted engine host
- ovirt_hosts:
    cluster: Default
    name: myhost2
    password: secret
    address: 10.34.61.145
    override_iptables: true
    hosted_engine: deploy

# Maintenance
- ovirt_hosts:
    state: maintenance
    name: myhost

# Restart host using power management:
- ovirt_hosts:
    state: restarted
    name: myhost

# Upgrade host
- ovirt_hosts:
    state: upgraded
    name: myhost

# discover iscsi targets
- ovirt_hosts:
    state: iscsidiscover
    name: myhost
    iscsi:
      username: iscsi_user
      password: secret
      address: 10.34.61.145
      port: 3260


# login to iscsi targets
- ovirt_hosts:
    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


# Reinstall host using public key
- ovirt_hosts:
    state: reinstalled
    name: myhost
    public_key: true

# Remove host
- ovirt_hosts:
    state: absent
    name: myhost
    force: True

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
iscsi_targets
List of host iscsi targets
On success if host is found and state is iscsidiscover. list
host
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.
On success if host is found. dict
id
ID of the host which is managed
On success if host is found. str 7de90f31-222c-436c-a1ca-7e655bd5b60c

Notes

Note

  • In order to use this module you have to install oVirt Python SDK. To ensure it’s installed with correct version you can create the following task: pip: name=ovirt-engine-sdk-python version=4.0.0

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/ovirt_hosts_module.html