ovirt_auth - Module to manage authentication to oVirt

New in version 2.2.


  • This module authenticates to oVirt engine and creates SSO token, which should be later used in all other oVirt modules, so all modules don’t need to perform login and logout. This module returns an Ansible fact called ovirt_auth. Every module can use this fact as auth parameter, to perform authentication.

Requirements (on host that executes module)

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


parameter required default choices comments
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.
A boolean flag indicating if the SDK should ask the server to send compressed responses. The default is True. Note that this is a hint for the server, and that it may return uncompressed data even when this parameter is set to True.
A boolean flag that indicates if the server TLS certificate and host name should be checked.
A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication.
The password of the user.
no present
  • present
  • absent
Specifies if a token should be created or revoked.
The maximum total time to wait for the response, in seconds. A value of zero (the default) means wait forever. If the timeout expires before the response is received an exception will be raised.
A string containing the base URL of the server. For example:
The name of the user. For example: [email protected].


  - block:
       # Create a vault with `ovirt_password` variable which store your
       # oVirt user's password, and include that yaml file with variable:
       - include_vars: ovirt_password.yml

       - name: Obtain SSO token with using username/password credentials
           username: [email protected]
           ca_file: ca.pem
           password: "{{ ovirt_password }}"

       # Previous task generated I(ovirt_auth) fact, which you can later use
       # in different modules as follows:
       - ovirt_vms:
           auth: "{{ ovirt_auth }}"
           state: absent
           name: myvm

      - name: Always revoke the SSO token
          state: absent
          ovirt_auth: "{{ ovirt_auth }}"

Return Values

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

name description returned type sample
ovirt_auth Authentication facts, needed to perform authentication to oVirt. success dictionary
name description returned type sample
token SSO token which is used for connection to oVirt engine. success string kdfVWp9ZgeewBXV-iq3Js1-xQJZPSEQ334FLb3eksoEPRaab07DhZ8ED8ghz9lJd-MQ2GqtRIeqhvhCkrUWQPw
timeout Number of seconds to wait for response. success int 0
ca_file CA file, which is used to verify SSL/TLS connection. success string ca.pem
url URL of the oVirt engine API endpoint. success string
insecure Flag indicating if insecure connection is used. success bool False
kerberos Flag indicating if kerberos is used for authentication. success bool False
compress Flag indicating if compression is used for connection. success bool True



  • Everytime you use ovirt_auth module to obtain ticket, you need to also revoke the ticket, when you no longer need it, otherwise the ticket would be revoked by engine when it expires. For an example of how to achieve that, please take a look at examples section.
  • 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
  • Note that in oVirt 4.1 if you want to use a user which is not administrator you must enable the ENGINE_API_FILTER_BY_DEFAULT variable in engine. In oVirt 4.2 and later it’s enabled by default.


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


This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

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