ovirt.ovirt.ovirt – oVirt inventory source

Note

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

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

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)