Files
fedora-infra_ansible/roles/openqa/worker/tasks/main.yml
Adam Williamson 5561372a5f openqa/worker: drop edk2-arm package install
It no longer exists and we're no longer doing 32-bit ARM tests.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-05-07 10:39:33 -07:00

221 lines
8.8 KiB
YAML

# Required vars
# - openqa_workers
## integer - number of worker instances to create/run
# Required vars with defaults
# - openqa_hostname
## string - hostname of openQA server to run jobs for
## default - localhost
# - openqa_repo
## string - Repo to enable when updating openQA packages. Set to
## 'updates-testing' to use packages from updates-testing
## default - 'updates', which is effectively a no-op
# - openqa_nfs_worker
## bool - whether this worker expects to share the factory dir with
## the server via NFS. If set, the nfs-client task will be
## run to set up the share. The worker should also be included
## in the server's openqa_nfs_workers var so it is granted
## access to the share
## default - false
# - openqa_hdds_worker
## bool - whether this worker creates base disk images for a shared
## factory dir. There should be only *one* of these per arch
## per deployment
## default - false
# - openqa_tap
## string - tap worker classes this worker should be part of, a comma-
## separated string, e.g. "tap" or "tap,tap2". If this is
## empty, the worker will not be configured for tap and
## swtpm at all; if it's not empty, the worker will be
## configured for tap and swtpm and the string substituted
## into the workers.ini config file. Only *one* worker
## should be in each tap worker class (so there should not
## be two workers in the "tap" class), but if you are short
## on workers, one worker can be in *multiple* tap classes,
## meaning it will pick up more tap jobs. The purpose of
## having multiple tap classes is to split the load of tap
## jobs across more than one host, when enough hosts are
## available
## default - empty string (disabled)
# Optional vars
# - deployment_type
## string - Fedora Infrastructure thing; for this role, applies an
## infra-specific tweak to httpd config. Don't set it outside
## Fedora infra.
# - openqa_rngd
## string - if set to any value, rng-tools package will be
## installed and rngd.service enabled/started
# - openqa_worker_class
## string - custom WORKER_CLASS value for workers.ini
# - openqa_static_uid
## int - a static ID for the geekotest group if desired. this is useful
## for NFS mounting openQA data files. The _openqa_worker user,
## which os-autoinst runs as, will be added to this group. The
## idea is that the same group with the same GID exists on the
## NFS server and is the group of the shared asset directories,
## so os-autoinst can write to the shared asset directories,
## which it needs to do when uncompressing compressed disk assets
# - openqa_critical_threshold
## string - custom CRITICAL_LOAD_AVG_THRESHOLD value for workers.ini.
## If worker host is above this load average, it will not pick
## up new jobs
---
- name: Remove old scratch repo directory
ansible.builtin.file: path=/var/tmp/scratchrepo state=absent
- name: Delete old scratch build repo config
ansible.builtin.file: path=/etc/yum.repos.d/scratchrepo.conf state=absent
- name: Write lab side repo config
ansible.builtin.copy: src=openqa-lab-repo.repo dest=/etc/yum.repos.d/openqa-lab-repo.repo owner=root group=root mode=0644
when: "deployment_type is defined and deployment_type == 'stg'"
- name: Write prod side repo config
ansible.builtin.copy: src=openqa-prod-repo.repo dest=/etc/yum.repos.d/openqa-prod-repo.repo owner=root group=root mode=0644
when: "deployment_type is defined and deployment_type == 'prod'"
- name: Install required packages
ansible.builtin.package:
name: ['openqa-worker', 'os-autoinst']
state: latest
enablerepo: "{{ openqa_repo }}"
notify:
- Restart openqa workers
tags:
- packages
- name: Install packages used by tests
ansible.builtin.package:
name: ['perl-JSON', 'perl-REST-Client']
state: latest
tags:
- packages
- name: Install packages used by ansible plays
ansible.builtin.package:
name: ['python3-libselinux', 'git']
state: present
tags:
- packages
- name: Create geekotest group with static GID
group: "name=geekotest gid={{ openqa_static_uid }} system=yes"
when: "openqa_static_uid is defined"
- name: Add _openqa_worker user to geekotest group
user: name=_openqa-worker groups=geekotest append=yes
when: "openqa_static_uid is defined"
- name: Install ffmpeg-free (not on aarch64)
ansible.builtin.package: name=ffmpeg-free state=present
tags:
- packages
when: "ansible_architecture is defined and ansible_architecture != 'aarch64'"
- name: Install UEFI firmware package (x86_64 only)
ansible.builtin.package: name=edk2-ovmf state=present
tags:
- packages
when: "ansible_architecture is defined and ansible_architecture == 'x86_64'"
- name: Install UEFI firmware package (aarch64 only)
ansible.builtin.package: name=edk2-aarch64 state=present
tags:
- packages
when: "ansible_architecture is defined and ansible_architecture == 'aarch64'"
# Encoding with ffmpeg gives us better videos, but it seems like it
# doesn't work well on aarch64, it overwhelms the CPU and makes tests
# often fail
- name: Block ffmpeg-free in dnf config (aarch64 only)
ini_file:
path: /etc/dnf/dnf.conf
section: main
option: excludepkgs
value: ffmpeg-free
when: "ansible_architecture is defined and ansible_architecture == 'aarch64'"
- name: Install rng-tools (if specified by openqa_rngd var)
ansible.builtin.package: name=rng-tools state=present
tags:
- packages
when: "openqa_rngd is defined and openqa_rngd"
- name: Install script to set /dev/kvm perms and disable SMT (ppc64 only)
ansible.builtin.copy: src=openqa-ppc64-prep.sh dest=/etc/cron.hourly/openqa-ppc64-prep owner=root group=root mode=0755
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
- name: Install systemd service to run boot script (ppc64 only)
ansible.builtin.copy: src=openqa-ppc64-prep.service dest=/etc/systemd/system/openqa-ppc64-prep.service
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
register: prepservice
- name: Do systemctl daemon-reload to register new service (ppc64 only)
systemd:
daemon_reload: yes
when: "prepservice is defined and prepservice is changed"
- name: Enable systemd service to run boot script (ppc64 only)
service: name=openqa-ppc64-prep enabled=yes state=started
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
- name: Enable rngd.service (if specified by openqa_rngd var)
service: name=rngd enabled=yes state=started
when: "openqa_rngd is defined and openqa_rngd"
- name: Install cron job to kill stuck qemu processes
ansible.builtin.copy: src=kill-stuck-qemu.sh dest=/etc/cron.daily/kill-stuck-qemu owner=root group=root mode=0755
- include_tasks: nfs-client.yml
when: openqa_nfs_worker|bool
- include_tasks: tap-setup.yml
when: openqa_tap
- name: Tell git it's OK for _openqa-worker to run 'git' on the test dir
ansible.builtin.copy: src=gitconfig dest=/etc/gitconfig owner=root group=root mode=0644
# this is kinda lazy - we could have a separate openqa_swtpm var so we
# we could potentially separate tap worker hosts from swtpm ones - but
# it makes workers.ini templating annoyingly awkward (we need way more
# conditionals to account for four possibilities rather than two) and
# for now it's fine to just assume the tap host(s) is/are also the
# swtpm host(s)
- name: Install swtpm packages
ansible.builtin.package:
name: ['swtpm', 'swtpm-tools']
state: latest
enablerepo: "{{ openqa_repo }}"
tags:
- packages
when: openqa_tap
- name: OpenQA client config
ansible.builtin.template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=_openqa-worker group=root mode=0600
tags:
- config
- name: OpenQA worker config
ansible.builtin.template: src=workers.ini.j2 dest=/etc/openqa/workers.ini owner=_openqa-worker group=root mode=0644
notify:
- Restart openqa workers
tags:
- config
- include_tasks: createhdds.yml
when: openqa_hdds_worker|bool
- name: Override kernel scheduler configuration - rhbz#2009585
ansible.builtin.copy: src=60-block-scheduler.rules dest=/etc/udev/rules.d/60-block-scheduler.rules owner=root group=root mode=0644
when: "deployment_type is defined"
- name: Remove wrongly-named kernel scheduler config file
ansible.builtin.file: path=/etc/udev/rules.d/60-block-scheduler-override.rules state=absent
- name: Enable and start worker services
service: name=openqa-worker@{{ item }} enabled=yes state=started
loop: "{{ range(1, openqa_workers + 1)|list }}"