Compare commits

...

8 Commits

Author SHA1 Message Date
Al Bowles
1c26ea706f
Use some more defaulty defaults 2023-11-17 22:56:23 -06:00
Al Bowles
ca08f4bb0e
Add some usages 2023-11-17 22:56:23 -06:00
Al Bowles
beb14b7a96
It turns out openqa does not like inline comments in its ini files 2023-11-17 22:56:23 -06:00
Al Bowles
d7ab984b4f
Start cache services 2023-11-17 22:56:18 -06:00
Al Bowles
96f68226dc
Move requirements file to meet convention 2023-11-17 22:56:18 -06:00
Al Bowles
b337544f5f
Add requirements file 2023-11-17 22:56:18 -06:00
Al Bowles
7d8bd73307
Update filelist 2023-11-17 22:56:09 -06:00
Al Bowles
2a237385ef
Automation for configuring a worker-only host 2023-11-17 22:56:02 -06:00
7 changed files with 180 additions and 3 deletions

View File

@ -17,26 +17,30 @@ This repository is for openQA operations and management.
├── handlers ├── handlers
│   └── main.yml │   └── main.yml
├── init-rocky-openqa-developer-host.yml ├── init-rocky-openqa-developer-host.yml
├── localhost.yml ├── init-rocky-openqa-worker-host.yml
├── README.md ├── README.md
├── roles ├── roles
│   └── README.md │   └── README.md
├── tasks ├── tasks
│   ├── main.yml │   ├── main.yml
│   ├── openqa-worker.yml
│   └── openqa.yml │   └── openqa.yml
├── templates ├── templates
│   └── etc │   └── etc
│   ├── firewalld │   ├── firewalld
│   │   └── services │   │   └── services
│   │   ├── openqa-socket.xml.j2
│   │   └── openqa-vnc.xml.j2 │   │   └── openqa-vnc.xml.j2
│   └── openqa │   └── openqa
│   ├── client.conf.j2 │   ├── client.conf.j2
│   └── openqa.ini.j2 │   ├── openqa.ini.j2
│   └── workers.conf.j2
├── tests ├── tests
│   ├── README.md │   ├── README.md
│   └── test.yml │   └── test.yml
└── vars └── vars
├── main.yml ├── main.yml
├── openqa-worker.yml
└── openqa.yml └── openqa.yml
``` ```

View File

@ -0,0 +1,3 @@
---
collections:
- ansible.posix

View File

@ -0,0 +1,48 @@
# Configure an openQA worker host
#
# Usages:
# # Install and configure an openQA worker-only host
# ansible-playbook init-rocky-openqa-worker-host.yml
#
# # Install and configure an openQA worker-only host with a parameters file
# ansible-playbook init-rocky-openqa-worker-host.yml -e @my-worker-host.yml
#
# Created: @akatch
---
- name: Rocky openQA Worker Runbook
hosts: openqa_workers
become: true
gather_facts: false
vars_files:
- vars/openqa-worker.yml
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
tasks:
- name: Install and configure OpenQA workers
import_tasks: tasks/openqa-worker.yml
post_tasks:
- name: Touching run file that ansible has ran here
file:
path: /var/log/ansible.run
state: touch
mode: '0644'
owner: root
group: root
...

75
tasks/openqa-worker.yml Normal file
View File

@ -0,0 +1,75 @@
---
- name: Install OpenQA worker packages
dnf:
name: "{{ openqa_worker_packages }}"
state: present
tags:
- packages
- name: Create openQA group
group:
name: "{{ openqa_group }}"
system: true
- name: Create openQA user
user:
name: "{{ openqa_user }}"
groups: "{{ openqa_group }}"
append: true
system: true
- name: Configure firewalld for openQA worker connections
template:
src: etc/firewalld/services/{{ item }}.xml.j2
dest: /etc/firewalld/services/{{ item }}.xml
owner: root
group: root
mode: "0644"
loop:
- openqa-socket
- openqa-vnc
tags:
- configure
- name: Reload firewalld
systemd:
name: firewalld
state: reloaded
tags:
- configure
ignore_errors: "{{ ansible_check_mode }}"
- name: Write openQA configuration file
template:
src: etc/openqa/{{ item }}.j2
dest: /etc/openqa/{{ item }}
owner: "{{ openqa_user }}"
group: "{{ openqa_group }}"
mode: "0444"
loop:
- client.conf
- workers.conf
tags:
- configure
- name: Start {{ openqa_worker_count }} openQA workers
ansible.builtin.systemd:
name: "openqa-worker@{{ item }}"
state: started
enabled: true
# range "end" parameter is exclusive, so add 1
loop: "{{ range(1, (openqa_worker_count|int + 1)) | list }}"
tags:
- start_workers
- configure
ignore_errors: "{{ ansible_check_mode }}"
- name: Start openQA cache services
ansible.builtin.systemd:
name: "{{ item }}"
state: started
enabled: true
loop:
- openqa-worker-cacheservice
- openqa-worker-cacheservice-minion
...

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<port port="{{ openqa_min_socket_port }}-{{ openqa_max_socket_port }}" protocol="tcp"/>
</service>

View File

@ -0,0 +1,7 @@
[global]
HOST = https://{{ openqa_host }}
CACHEDIRECTORY = /var/lib/openqa/cache
CACHE_MIN_FREE_PERCENTAGE = 10
[https://{{ openqa_host }}]
TESTPOOLSERVER = rsync://{{ openqa_host }}/tests

36
vars/openqa-worker.yml Normal file
View File

@ -0,0 +1,36 @@
---
# The primary openQA host
openqa_host: localhost
openqa_client_key: 1234567890ABCDEF
openqa_client_secret: 1234567890ABCDEF
# Default OpenQA user and group
openqa_user: geekotest
openqa_group: geekotest
# The number of workers to enable on this system
openqa_worker_count: 1
# Port range to open for VNC access to local workers.
# The max port should be 5990 + n where n is the total
# number of workers you want to enable on your system.
openqa_min_vnc_port: 5991
openqa_max_vnc_port: "{{ 5990 + openqa_worker_count|int }}"
# Port range to open for socket connections from the primary host.
openqa_min_socket_port: 20000
openqa_max_socket_port: 20089
# Packages to install
openqa_worker_packages:
- guestfs-tools
- libguestfs-xfs
- libvirt-daemon-config-network
- virt-install
- openqa-worker
- perl-REST-Client
- python3-libguestfs
- virt-install
- withlock
- firewalld
...