Skip to content

Commit 1d35cb4

Browse files
committed
Add support for usbip needed for virtual passkey
- passkey usbip ansible code converted from shell script with gemini. - Also updating keycloak dep package to java-25-openjdk-headless Assisted-by: Gemini
1 parent eb30021 commit 1d35cb4

File tree

8 files changed

+169
-1
lines changed

8 files changed

+169
-1
lines changed

src/ansible/roles/packages/tasks/CentOS10.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@
3838

3939
- name: 'Packages are the same as in Fedora'
4040
include_tasks: 'Fedora.yml'
41+
42+
- name: Install packages for usbip needed for virtual passkey testing
43+
dnf:
44+
state: present
45+
name:
46+
- gcc
47+
- make
48+
- automake
49+
- autoconf
50+
- systemd-devel
51+
- libtool
52+
when:
53+
- passkey_support
54+
- "'base_client' in group_names or 'client' in group_names"

src/ansible/roles/packages/tasks/Fedora.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,33 @@
282282
when: passkey_support
283283
when: "'base_client' in group_names or 'client' in group_names or 'base_ipa' in group_names or 'ipa' in group_names"
284284

285+
- name: Install packages only needed on client for passkey testing
286+
block:
287+
- name: Install koji on the client
288+
dnf:
289+
state: present
290+
name:
291+
- koji
292+
293+
- name: Install usbip on the client if running Fedora
294+
dnf:
295+
state: present
296+
name:
297+
- usbip
298+
when:
299+
- ansible_distribution == "Fedora"
300+
when:
301+
- passkey_support
302+
- "'base_client' in group_names or 'client' in group_names"
303+
285304
- name: Install packages for Keycloak base image
286305
block:
287306
- name: Install Keycloak dependencies
288307
dnf:
289308
state: present
290309
allowerasing: true
291310
name:
292-
- java-21-openjdk-headless
311+
- java-25-openjdk-headless
293312
- openssl
294313
- unzip
295314
- curl
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- name: Install EPEL repository
2+
dnf:
3+
state: present
4+
name: 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm'
5+
disable_gpg_check: yes
6+
when: extended_packageset
7+
8+
- name: Install packages for usbip needed for virtual passkey testing
9+
dnf:
10+
state: present
11+
name:
12+
- gcc
13+
- make
14+
- automake
15+
- autoconf
16+
- systemd-devel
17+
- libtool
18+
when:
19+
- passkey_support
20+
- "'base_client' in group_names or 'client' in group_names"
21+
22+
- name: 'Packages are the same as in Fedora'
23+
include_tasks: 'Fedora.yml'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
test_venv: /opt/test_venv
2+
#kver: "{{ ansible_kernel | regex_replace('\\.[^.]*$', '') }}"
3+
kver: "{{ ansible_kernel | regex_replace('\\.' + ansible_architecture + '$', '') }}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
- name: Create temporary build directory
2+
tempfile:
3+
state: directory
4+
suffix: usbip_build
5+
register: build_dir
6+
7+
- name: Ensure Koji config directory exists
8+
file:
9+
path: "~/.koji/config.d"
10+
state: directory
11+
mode: '0755'
12+
13+
- name: Configure CentOS Stream Koji profile
14+
copy:
15+
dest: "~/.koji/config.d/centos-stream.conf"
16+
content: |
17+
[centos-stream]
18+
server = https://kojihub.stream.centos.org/kojihub
19+
topurl = https://kojihub.stream.centos.org/kojifiles
20+
21+
- name: Download Kernel Source RPM via Koji
22+
command:
23+
cmd: "koji --profile centos-stream download-build --arch=src kernel-{{ kver }}"
24+
chdir: "{{ build_dir.path }}"
25+
args:
26+
creates: "{{ build_dir.path }}/kernel-{{ kver }}.src.rpm"
27+
28+
- name: Extract Source RPM and Kernel Tarball
29+
shell: |
30+
set -ex
31+
rpm2cpio kernel-{{ kver }}.src.rpm | cpio -id
32+
xz -dc linux-{{ kver }}.tar.xz | tar xf -
33+
args:
34+
chdir: "{{ build_dir.path }}"
35+
creates: "{{ build_dir.path }}/linux-{{ kver }}/tools/usb/usbip/configure"
36+
37+
- name: Build and Install USBIP tools
38+
shell: |
39+
set -ex
40+
./autogen.sh
41+
./configure
42+
make install
43+
args:
44+
chdir: "{{ build_dir.path }}/linux-{{ kver }}/tools/usb/usbip/"
45+
creates: "/usr/local/sbin/usbip"
46+
47+
- name: Create symlink for usbip
48+
file:
49+
src: /usr/local/sbin/usbip
50+
dest: /usr/sbin/usbip
51+
state: link
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Placeholder for Fedora specific passkey test deps
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
- name: Create temporary build directory
2+
tempfile:
3+
state: directory
4+
suffix: usbip_build
5+
register: build_dir
6+
7+
- name: Ensure Koji config directory exists
8+
file:
9+
path: "~/.koji/config.d"
10+
state: directory
11+
mode: '0755'
12+
13+
- name: Configure CentOS Stream Koji profile
14+
copy:
15+
dest: "~/.koji/config.d/centos-stream.conf"
16+
content: |
17+
[centos-stream]
18+
server = https://kojihub.stream.centos.org/kojihub
19+
topurl = https://kojihub.stream.centos.org/kojifiles
20+
21+
- name: Download Kernel Source RPM via Koji
22+
command:
23+
cmd: "koji --profile centos-stream download-build --arch=src kernel-{{ kver }}"
24+
chdir: "{{ build_dir.path }}"
25+
args:
26+
creates: "{{ build_dir.path }}/kernel-{{ kver }}.src.rpm"
27+
28+
- name: Extract Source RPM and Kernel Tarball
29+
shell: |
30+
set -ex
31+
rpm2cpio kernel-{{ kver }}.src.rpm | cpio -id
32+
xz -dc linux-{{ kver }}.tar.xz | tar xf -
33+
args:
34+
chdir: "{{ build_dir.path }}"
35+
creates: "{{ build_dir.path }}/linux-{{ kver }}/tools/usb/usbip/configure"
36+
37+
- name: Build and Install USBIP tools
38+
shell: |
39+
set -ex
40+
./autogen.sh
41+
./configure
42+
make install
43+
args:
44+
chdir: "{{ build_dir.path }}/linux-{{ kver }}/tools/usb/usbip/"
45+
creates: "/usr/local/sbin/usbip"
46+
47+
- name: Create symlink for usbip
48+
file:
49+
src: /usr/local/sbin/usbip
50+
dest: /usr/sbin/usbip
51+
state: link

src/ansible/roles/passkey/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,11 @@
6464
update: yes
6565
depth: 1
6666

67+
- name: 'Include distribution specific tasks [{{ ansible_distribution }} {{ ansible_distribution_major_version }}]'
68+
include_tasks: '{{ include_file }}'
69+
loop_control:
70+
loop_var: include_file
71+
with_first_found:
72+
- files: '{{ ansible_distribution | distro_includes(ansible_distribution_major_version) }}'
73+
6774
when: passkey_support

0 commit comments

Comments
 (0)