Questo contenuto non è disponibile nella lingua selezionata.
3.5. Automating Configuration Tasks using Ansible
Ansible is an automation tool used to configure systems, deploy software, and perform rolling updates. Red Hat Virtualization includes a limited version of Ansible to automate RHV post-installation tasks such as data center setup and configuration, managing users, and virtual machine operations.
Ansible provides an easier method of automating Red Hat Virtualization configuration compared to REST APIs and SDKs, and you can integrate with other Ansible modules. For more information about the Ansible modules available for Red Hat Virtualization, see the oVirt Ansible Collection in the Red Hat Ansible Automation Hub documentation.
Ansible Tower is a graphically enabled framework accessible through a web interface and REST APIs for Ansible. If you want support for Ansible Tower, then you must have an Ansible Tower license, which is not part of the Red Hat Virtualization subscription.
See the Ansible documentation for alternate installation instructions, and information about using Ansible.
3.5.1. oVirt Ansible Collection Copia collegamentoCollegamento copiato negli appunti!
oVirt Ansible Collection provides modules, roles, and plugins for managing various parts of the Red Hat Virtualization infrastructure. The modules are used for communication between Ansible and the Red Hat Virtualization Manager. Ansible roles provide a method of modularizing Ansible code by breaking up large playbooks into smaller reusable files that can be shared with other users. For more information about oVirt Ansible Collection, see the Automation Hub documentation.
3.5.1.1. Installing oVirt Ansible Collection from an RPM package Copia collegamentoCollegamento copiato negli appunti!
You can install oVirt Ansible Collection for Red Hat Virtualization from the Red Hat Virtualization Manager repository.
Prerequisites
To install oVirt Ansible Collection, you must subscribe to one of the following subscription channels:
- Using a Red Hat Virtualization subscription - rhv-4.4-manager-for-rhel-8-x86_64-rpms
- Using any Red Hat Enterprise Linux subscription - rhv-4-tools-for-rhel-8-x86_64-rpms
Procedure
Run the following command to install the oVirt Ansible Collection on the Manager machine:
dnf install ovirt-ansible-collection
# dnf install ovirt-ansible-collection
Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the collection is installed to:
/usr/share/ansible/collections/ansible_collections/redhat/rhv.
The structure of the
ovirt-ansible-collection
package is as follows:/usr/share/ansible/collections/ansible_collections/redhat/rhv/usr/share/doc/ovirt-ansible-collection/
3.5.1.2. Installing oVirt Ansible Collection from Automation Hub Copia collegamentoCollegamento copiato negli appunti!
Automation Hub is a new place that can be used to install oVirt Ansible Collection. To configure the environment, follow the instructions in oVirt Ansible Collection documentation.
Procedure
Install the collection
ansible-galaxy collection install redhat.rhv
# ansible-galaxy collection install redhat.rhv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Automation Hub currently does not install RPM dependencies. Make sure that you have these packages on the host where you execute the playbook:
-
python3-ovirt-engine-sdk4
-
python3-netaddr
-
python3-jmespath
-
python3-passlib
-
3.5.1.3. Using oVirt Ansible Collection to Configure Red Hat Virtualization Copia collegamentoCollegamento copiato negli appunti!
The following procedure guides you through creating and running a playbook that uses oVirt Ansible Collection to configure Red Hat Virtualization. This example uses Ansible to connect to the Manager on the local machine and create a new data center.
Prerequisites
- Ensure that you have the Python SDK installed on the machine running the playbook.
Procedure
Create your playbook.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You have successfully used the infra
Ansible role from oVirt Ansible Collection to create a data center named mydatacenter
.