+

Search Tips   |   Advanced Search

oVirt Ansible Modules

The set of modules for interacting with oVirt/RHV are currently part of the community.general collection (on Galaxy, source code repository). This document serves as developer coding guidelines for creating oVirt/RHV modules.


Naming


Interface


Interoperability


Libraries


New module development

Please read Should you develop a module?, first to know what common properties, functions and features every module must have.

In order to achieve idempotency of oVirt entity attributes, a helper class was created. The first thing you need to do is to extend this class and override a few methods:

The code above handle the check if the entity should be updated, so we don't update the entity if not needed and also it construct the needed entity of the SDK.

If your module must support action handling (for example, virtual machine start) you must ensure that you handle the states of the virtual machine correctly, and document the behavior of the module:

As you can see from the preceding example, the action method accepts the action_condition and wait_condition, which are methods which accept the virtual machine object as a parameter, so you can check whether the virtual machine is in a proper state before the action. The rest of the parameters are for the start action. You may also handle pre- or post- action tasks by defining pre_action and post_action parameters.


Testing

Next Previous