ovirt.ovirt.ovirt_host module – Module to manage hosts in oVirt/RHV
Note
This module is part of the ovirt.ovirt collection (version 3.2.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 ovirt.ovirt
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ovirt.ovirt.ovirt_host
.
New in ovirt.ovirt 1.0.0
Synopsis
Module to manage hosts in oVirt/RHV
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
ovirt-engine-sdk-python >= 4.4.0
Parameters
Parameter |
Comments |
---|---|
If This parameter is good to disable, when you don’t want to change the state of host when using present Choices:
|
|
Host address. It can be either FQDN (preferred) or IP address. |
|
Dictionary with values needed to create HTTP/HTTPS connection to oVirt: |
|
A PEM file containing the trusted CA certificates. The certificate presented by the server will be verified using these CA certificates. If Default value is set by |
|
Flag indicating if compression is used for connection. Choices:
|
|
Dictionary of HTTP headers to be added to each API call. |
|
A string containing the hostname of the server, usually something like `server.example.com`. Default value is set by Either |
|
A boolean flag that indicates if the server TLS certificate and host name should be checked. Choices:
|
|
A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication. Choices:
|
|
The password of the user. Default value is set by |
|
Number of seconds to wait for response. |
|
Token to be used instead of login with username/password. Default value is set by |
|
A string containing the API URL of the server, usually something like `https://server.example.com/ovirt-engine/api`. Default value is set by Either |
|
The name of the user, something like admin@internal. Default value is set by |
|
If true and Choices:
|
|
Name of the cluster, where host should be created. |
|
Description of the host. |
|
Enrolls the certificate of the host. Useful in case you get a warning that it is about to expire or has already expired. The host must be in maintenance status before enrolling the certificates. Choices:
|
|
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 Choices:
|
|
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. Choices:
|
|
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. Choices:
|
|
ID of the host to manage. |
|
If If |
|
Address of the iSCSI storage server. |
|
A CHAP password for logging into a target. |
|
The port being used to connect with iscsi. |
|
The portal being used to connect with iscsi. |
|
The target IQN for the storage device. |
|
A CHAP user name for logging into a target. |
|
Specify if host will have enabled Kdump integration. Choices:
|
|
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
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 successfully and then to be rebooted for kernel boot parameters to be applied. |
|
Name of the host to manage. |
|
Specifies list of the attributes which should be fetched from the API. This parameter apply only when |
|
Override the display address of all VMs on this host with specified address. |
|
If True host iptables will be overridden by host deploy script. Note that Choices:
|
|
Password of the root. It’s required in case |
|
Number of the seconds the module waits until another poll request on entity status is sent. Default: |
|
Enable or disable power management of the host. For more comprehensive setup of PM use Choices:
|
|
True if the public key should be used to authenticate to host. It’s required in case Choices:
|
|
If true reboot host after successful installation. Default value on engine is true. Choices:
|
|
If true and Choices:
|
|
SPM priority of the host. Integer value from 1 to 10, where higher number means higher priority. |
|
The host SSH port. |
|
State which should a host to be in after successful completion. iscsilogin and iscsidiscover are supported since version 2.4. refreshed is supported since 3.1.0 Choices:
|
|
The amount of time in seconds the module should wait for the host to get into desired state. Default: |
|
If 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 separated, each vGPU is placed on a separate physical card, if possible. This can be useful for improving vGPU performance. Choices:
|
|
Choices:
|
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.4.0
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.ovirt.ovirt_host:
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.ovirt.ovirt_host:
public_key: true
cluster: Default
name: myhost2
address: 10.34.61.145
override_iptables: true
# Deploy hosted engine host
- ovirt.ovirt.ovirt_host:
cluster: Default
name: myhost2
password: secret
address: 10.34.61.145
override_iptables: true
hosted_engine: deploy
# Maintenance
- ovirt.ovirt.ovirt_host:
state: maintenance
name: myhost
# Restart host using power management:
- ovirt.ovirt.ovirt_host:
state: restarted
name: myhost
# Upgrade host
- ovirt.ovirt.ovirt_host:
state: upgraded
name: myhost
# discover iscsi targets
- ovirt.ovirt.ovirt_host:
state: iscsidiscover
name: myhost
iscsi:
username: iscsi_user
password: secret
address: 10.34.61.145
port: 3260
# login to iscsi targets
- ovirt.ovirt.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
# Reinstall host using public key
- ovirt.ovirt.ovirt_host:
state: reinstalled
name: myhost
public_key: true
# Remove host
- ovirt.ovirt.ovirt_host:
state: absent
name: myhost
force: True
# Retry removing host when failed (https://bugzilla.redhat.com/show_bug.cgi?id=1719271)
- ovirt.ovirt.ovirt_host:
state: absent
name: myhost
register: result
until: not result.failed
retries: 6
delay: 20
# Change host Name
- ovirt.ovirt.ovirt_host:
id: 00000000-0000-0000-0000-000000000000
name: "new host name"
- name: Enroll host certificates
ovirt.ovirt.ovirt_host:
state: maintenance
name: myhost
enroll_certificate: True
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
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. |
|
ID of the host which is managed Returned: On success if host is found. Sample: |
|
List of host iscsi targets Returned: On success if host is found and state is iscsidiscover. |