ovirt.ovirt.ovirt – oVirt inventory source

Note

This plugin is part of the ovirt.ovirt collection (version 1.6.4).

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.

To use it in a playbook, specify: ovirt.ovirt.ovirt.

New in version 1.0.0: of ovirt.ovirt

Synopsis

  • Get inventory hosts from the ovirt service.
  • Requires a YAML file ending in ‘ovirt.yml’, ‘ovirt4.yml’, ‘ovirt.yaml’, ‘ovirt4.yaml’.

Requirements

The below requirements are needed on the local controller node that executes this inventory.

  • ovirt-engine-sdk-python >= 4.2.4

Parameters

Parameter Choices/Defaults Configuration Comments
cache
boolean
    Choices:
  • no
  • yes
ini entries:

[inventory]
cache = no

env:ANSIBLE_INVENTORY_CACHE
Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.
cache_connection
string
ini entries:

[defaults]
fact_caching_connection = None

[inventory]
cache_connection = None

env:ANSIBLE_CACHE_PLUGIN_CONNECTION
env:ANSIBLE_INVENTORY_CACHE_CONNECTION
Cache connection data or path, read cache plugin documentation for specifics.
cache_plugin
string
Default:
"memory"
ini entries:

[defaults]
fact_caching = memory

[inventory]
cache_plugin = memory

env:ANSIBLE_CACHE_PLUGIN
env:ANSIBLE_INVENTORY_CACHE_PLUGIN
Cache plugin to use for the inventory's source data.
cache_prefix
string
Default:
"ansible_inventory_"
ini entries:

[default]
fact_caching_prefix = ansible_inventory_

[inventory]
cache_prefix = ansible_inventory_

env:ANSIBLE_CACHE_PLUGIN_PREFIX
env:ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
Prefix to use for cache plugin files/tables
cache_timeout
integer
Default:
3600
ini entries:

[defaults]
fact_caching_timeout = 3600

[inventory]
cache_timeout = 3600

env:ANSIBLE_CACHE_PLUGIN_TIMEOUT
env:ANSIBLE_INVENTORY_CACHE_TIMEOUT
Cache duration in seconds
compose
dictionary
Default:
{}
Create vars from jinja2 expressions.
groups
dictionary
Default:
{}
Add hosts to group based on Jinja2 conditionals.
keyed_groups
list / elements=string
Default:
[]
Add hosts to group based on the values of a variable.
leading_separator
boolean
added in 2.11 of ansible.builtin
    Choices:
  • no
  • yes
Use in conjunction with keyed_groups.
By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore.
This is because the default prefix is "" and the default separator is "_".
Set this option to False to omit the leading underscore (or other separator) if no prefix is given.
If the group name is derived from a mapping the separator is still used to concatenate the items.
To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead.
ovirt_cafile
string
path to ovirt-engine CA file. If ovirt_cafile parameter is not set and ovirt_insecure is not True, system wide CA certificate store is used.
ovirt_hostname_preference
list / elements=string
Default:
["fqdn", "name"]
list of options that describe the ordering for which hostnames should be assigned. See https://ovirt.github.io/ovirt-engine-api-model/master/#types/vm for available attributes.
ovirt_insecure
string
A boolean flag that indicates if the server TLS certificate and host name should be checked.
ovirt_password
string / required
env:OVIRT_PASSWORD
ovirt authentication password.
ovirt_query_filter
string
dictionary of filter key-values to query VM's. See https://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4.services.VmsService.list for filter parameters.
ovirt_url
string / required
env:OVIRT_URL
URL to ovirt-engine API.
ovirt_username
string / required
env:OVIRT_USERNAME
ovirt authentication user.
plugin
string / required
    Choices:
  • ovirt
  • ovirt.ovirt.ovirt
  • redhat.rhv.ovirt
the name of this plugin, it should always be set to 'ovirt' for this plugin to recognise it as it's own.
strict
boolean
    Choices:
  • no
  • yes
If yes make invalid entries a fatal error, otherwise skip and continue.
Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.
use_extra_vars
boolean
added in 2.11 of ansible.builtin
    Choices:
  • no
  • yes
ini entries:

[inventory_plugins]
use_extra_vars = no

env:ANSIBLE_INVENTORY_USE_EXTRA_VARS
Merge extra vars into the available variables for composition (highest precedence).

Examples

# Ensure the CA is available:
# $ wget "https://engine/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA" -O /path/to/ca.pem
# Sample content of ovirt.yml:
plugin: ovirt.ovirt.ovirt
ovirt_url: https://engine/ovirt-engine/api
ovirt_cafile: /path/to/ca.pem
ovirt_username: ansible-tester
ovirt_password: secure
ovirt_query_filter:
  search: 'name=myvm AND cluster=mycluster'
  case_sensitive: no
  max: 15
keyed_groups:
  - key: cluster
    prefix: 'cluster'
groups:
  dev: "'dev' in tags"
compose:
  ansible_host: devices["eth0"][0]

Authors

  • Bram Verschueren (@bverschueren)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_inventory.html