Prepare Plugins

Common Keys

The following keys are accepted by all plugins of the prepare step.

name:

The name of the step phase.

order:

Order in which the phase should be handled.

Default: 50

summary:

Concise summary describing purpose of the phase.

Default: not set

where: GUEST|ROLE

Run this phase on given guest or guests with the given role only.

Default: not set

install

Warning

Please, be aware that the documentation below is a work in progress. We are working on fixing it, adding missing bits and generally making it better. Also, it was originally used for command line help only, therefore the formatting is often suboptimal.

Install packages on the guest.

Example config:

prepare:
    how: install
    copr: psss/tmt
    package: tmt-all
    missing: fail

Use copr for enabling desired Copr repository and missing to choose whether missing packages should be silently ignored (skip) or a preparation error should be reported (fail), which is the default.

In addition to package name you can also use one or more paths to local rpm files to be installed:

prepare:
    how: install
    package:
        - tmp/RPMS/noarch/tmt-0.15-1.fc31.noarch.rpm
        - tmp/RPMS/noarch/python3-tmt-0.15-1.fc31.noarch.rpm

Use directory to install all packages from given folder and exclude to skip selected packages:

prepare:
    how: install
    directory: tmp/RPMS/noarch
    exclude: tmt+provision-virtual

Note

When testing ostree booted deployments tmt will use rpm-ostree as the package manager to perform the installation of requested packages. The current limitations of the rpm-ostree implementation are:

  • Cannot install new version of already installed local rpm.

  • No support for installing debuginfo packages at this time.

Configuration

See also Common Keys accepted by the plugin.

copr: REPO

Copr repository to be enabled.

Default: not set

directory: PATH

Path to a local directory with rpm packages.

Default: not set

exclude: PACKAGE

Packages to be skipped during installation.

Default: not set

missing: ACTION

Action on missing packages, fail (default) or skip.

Default: fail

package: PACKAGE

Package name or path to rpm to be installed.

Default: not set


ansible

Prepare guest using Ansible.

Run Ansible playbooks against the guest, by running ansible-playbook for all given playbooks.

Warning

When specifying playbooks with paths:

  • If a metadata tree root exists, all paths must be relative to the metadata tree root.

  • If the metadata tree root does not exist, all paths must be relative to the current working directory.

Warning

The plugin may be a subject of various limitations, imposed by Ansible itself:

  • Ansible 2.17+ no longer supports Python 3.6 and older. Guests where Python 3.7+ is not available cannot be prepared with the ansible plugin. This has been observed when Fedora Rawhide runner is used with CentOS 7 or CentOS Stream 8 guests. Possible workarounds: downgrade Ansible tmt uses, or install Python 3.7+ before using ansible plugin from an alternative repository or local build.

Run a single playbook on the guest:

prepare:
    how: ansible
    playbook: ansible/packages.yml
prepare --how ansible --playbook ansible/packages.yml

Run multiple playbooks in one phase, with extra arguments for ansible-playbook:

prepare:
    how: ansible
    playbook:
      - one.yml
      - two.yml
    extra-args: '-vvv'
prepare --how ansible --playbook one.yml --playbook two.yml --extra-args '-vvv'

Remote playbooks can be referenced as well as local ones, and both kinds can be intermixed:

prepare:
    how: ansible
    playbook:
      - https://foo.bar/one.yml
      - two.yml
prepare --how ansible --playbook https://foo.bar/two.yml --playbook two.yml

Configuration

See also Common Keys accepted by the plugin.

extra-args: ANSIBLE-PLAYBOOK-OPTIONS

Additional CLI options for ansible-playbook.

Default: not set

playbook: PATH|URL

Path or URL of an ansible playbook to run. The playbook path must be relative to the metadata tree root.

Default: not set


shell

Warning

Please, be aware that the documentation below is a work in progress. We are working on fixing it, adding missing bits and generally making it better. Also, it was originally used for command line help only, therefore the formatting is often suboptimal.

Prepare guest using shell (Bash) scripts.

Run various commands and scripts on the guest:

prepare:
    how: shell
    script:
      - sudo dnf install -y 'dnf-command(copr)'
      - sudo dnf copr enable -y psss/tmt
      - sudo dnf install -y tmt

Configuration

See also Common Keys accepted by the plugin.

script: SCRIPT

Shell script to be executed. Can be used multiple times.

Default: not set


feature

Warning

Please, be aware that the documentation below is a work in progress. We are working on fixing it, adding missing bits and generally making it better. Also, it was originally used for command line help only, therefore the formatting is often suboptimal.

Enable or disable common features like repositories on the guest.

Warning

The plugin may be a subject of various limitations, imposed by the fact it uses Ansible to implement some of the features:

  • Ansible 2.17+ no longer supports Python 3.6 and older. Guests where Python 3.7+ is not available cannot be prepared with the feature plugin. This has been observed when Fedora Rawhide runner is used with CentOS 7 or CentOS Stream 8 guests. Possible workarounds: downgrade Ansible tmt uses, or install Python 3.7+ before using feature plugin from an alternative repository or local build.

Example config:

prepare:
    how: feature
    epel: enabled

Or

prepare:
    how: feature
    epel: disabled

Configuration

See also Common Keys accepted by the plugin.

epel: enabled|disabled

Whether EPEL repository should be installed & enabled or disabled.

Default: not set