As the name describes, kvm-env-deployment is a self-service ansible playbook for deploying a KVM test environment.
|
Caution
|
This repository is currently only supports RHEL9+ |
Ansible can be installed by many methods:
-
Install a released version via
pip. -
Install community version from EPEL repository.
virt_install_method: "local"
pkg_id: "6620"
force_install: false
suite_type: "kar"
ignore_untested: true$ ansible-playbook -i localhost, -u root -e "@variables.yml" site.ymlProvided as a deployment playbook for kvm test environment, it contains two roles: pre_stage and virt_install.
Provided as a test playbook to execute the test suite only, it contains one role: test_suite.
Includes all the roles of the above two playbooks. It is the top level playbook that defines the entire infrastructure.
pre_stage contains many tasks that need to be prepared early.
virt_install will install specified packages that exist in the virt module.
|
Tip
|
Please use the virt_install_method variable to switch the installer.
|
-
Create YUM repository file
-
Remote Virt Repository
-
Create the virt repository file with the given uri (Requires
virt_repo_link)
-
-
Local Private Virt Repository
-
Using specified
NVRID to generate a list with all packages viabrew -
Download all packages to local path
-
Create a local repository using
createrepo -
Create the private virt repository file
-
-
-
Install specified virt packages
-
Enable and start libvirt related services/sockets
-
Redefine the virbr0
task-suite executes a command, after completion, the test results will be compressed and passed to the ansible execution host, analyze the results and finally delete the log directory of the remote host.
There are some configurable extra variables for this playbook, they are divided into global [1] extra variables and role-specific [2] extra variables. Global extra variables mean that they will be used in 2 or more roles, while role-specific extra variables will only be used in a single role.
Using yaml/json format in --extra-vars/-e argument can more efficient manage multiple sets of extra variables.
Example usage:
{"str_key": "hello"}{"int_key": 1, "float_key": 1.0}{"bool_key": true}{"fact_key": "{{ ansible_distribution_version }}"}- kar_path
-
The path of where the kar repository should be checked out, it used for
pre_stageandtest_suite.
- bridge_type
-
Type of bridge to be created. Currently, supports linux_bridge and ovs_bridge.
- ovs_pkg
-
Specify the Open vSwitch version, only used for ovs_bridge.
- bridge_name
-
The bridge name.
- cloned_mac
-
Clone MAC address from the source NIC
- dep_pkgs
-
Some basic dependent packages you want to install for your system.
- bootstrap_args
-
Arguments specified during the kar bootstrap phase.
- virt_install_method
-
Virt installer, remote will use the given uri, and local will download all virt rpm packages then create a local repo via
createrepo, they will both create a YUM repository file. If you want to use virt packages provided by the system, please use system. - virt_repo_link
-
Only when virt_install_method=remote
An available virt repo link, it can from brewroot or anywhere. - pkg_id
-
Only when virt_install_method=local
ID ofNVR. If it’s not set, the playbook will obtain the qemu-kvm version of ansible execution host to capture the package ID. - brew_root
-
Only when virt_install_method=local
File share web server url of brew. - virt_pkgs_path
-
Only when virt_install_method=local
Directory to index of the local virt repository. - virt_pkgs
-
A common list of basic virt packages to be installed.
- virt_ext_pkgs
-
An extra list of virt packages to be installed.
- force_install
-
Whether to force the installation if specified packages are already installed.
- virbr0_subnet
-
Redefine the virbr0’s network information, a valid subnet can be set. For instance:
virbr0_subnet: 192.168.2
- suite_type
-
Test suite to be executed, the valid options are
karandkvm_unit_test. - vt_type
-
Only when suite_type=kar
TheVT_TYPEof kar, supported configurations areqemuandlibvirt, and the default isqemu. - kar_args
-
Only when suite_type=kar
Arguments you want to add when executingpython3 ConfigTest.py, except for--customsparams. - kar_customsparams
-
Only when suite_type=kar
Multiple sets of variables for--customsparamsneed to be enclosed in quotes, so split it into an independent extra variable.
Noted that special characters need to be escaped. E.g:\n→\\n - unittest_job_dir
-
Only when suite_type=kvm_unit_test
Forces using of an alternate job results directory for kvm-unit-test. - test_harness_log_dir
-
Ansible execution host directory where you want to save test results.
- ignore_untested
-
When the status of some test cases is
SKIP/CANCEL, whether judged that the result of the playbook as failure.