refactor(ansible): Estandariza nombres de roles y actualiza Koji
Se estandarizan los nombres de los directorios de roles, cambiando guiones por guiones bajos. Se añaden nuevos scripts para limpieza y callbacks en Koji Hub. Además, se actualizan las configuraciones de Kojid, Kojira y PostgreSQL, incluyendo la instalación de paquetes, ajustes de mock y la gestión de variables.
This commit is contained in:
parent
08c38d3d56
commit
39aeb2d6b6
91 changed files with 1037 additions and 957 deletions
5
roles/koji_hub/templates/00-main.conf.j2
Normal file
5
roles/koji_hub/templates/00-main.conf.j2
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[hub]
|
||||
KojiWebURL = https://{{ koji_hub_fqdn }}/koji
|
||||
KojiDir = {{ koji_top_dir }}
|
||||
AuthMethods = ssl, password
|
||||
LoginCreatesUser = On
|
||||
8
roles/koji_hub/templates/99-local-policies.conf.j2
Normal file
8
roles/koji_hub/templates/99-local-policies.conf.j2
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[hub-policy:admin]
|
||||
user = {{ koji_admin_user }}
|
||||
|
||||
[task:newRepo]
|
||||
channel = repo
|
||||
|
||||
[task:build_rpm]
|
||||
user = builder
|
||||
2
roles/koji_hub/templates/admin.conf.j2
Normal file
2
roles/koji_hub/templates/admin.conf.j2
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[hub]
|
||||
AdminUsers = {{ koji_admin_user }}
|
||||
3
roles/koji_hub/templates/callbacks.conf.j2
Normal file
3
roles/koji_hub/templates/callbacks.conf.j2
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[hub]
|
||||
CallbackFile = /usr/local/bin/koji_callbacks.py
|
||||
CallbackRegex = .*
|
||||
2
roles/koji_hub/templates/db.conf.j2
Normal file
2
roles/koji_hub/templates/db.conf.j2
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[hub]
|
||||
DBConnectionString = postgresql://{{ koji_db_user }}:{{ koji_db_password }}@{{ koji_db_host }}/{{ koji_db_name }}?sslmode=verify-full&sslrootcert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
25
roles/koji_hub/templates/hub.conf.j2
Normal file
25
roles/koji_hub/templates/hub.conf.j2
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Koji Hub Configuration
|
||||
[hub]
|
||||
# Main directory for Koji data (packages, repos, etc.)
|
||||
KojiDir = {{ koji_top_dir }}
|
||||
|
||||
# Authentication methods. 'ssl' is primary for clients, 'password' for web UI.
|
||||
AuthMethods = ssl, password
|
||||
|
||||
# Automatically create a user account on first successful SSL login.
|
||||
LoginCreatesUser = On
|
||||
|
||||
# Header used by Apache/mod_proxy to forward the original client IP.
|
||||
ProxyUserHeader = X-Forwarded-For
|
||||
|
||||
# Message to display in the client when the hub is offline.
|
||||
ServerOfflineMessage = The Koji build system is currently offline for maintenance.
|
||||
|
||||
# How long builder should wait for host-init to finish (seconds)
|
||||
HostInitTimeout = 120
|
||||
|
||||
Plugins = sigul_sign
|
||||
|
||||
[sigul]
|
||||
# Sigul server URL (replace with actual Sigul server address)
|
||||
SigulServer = {{ sigul_server }}
|
||||
9
roles/koji_hub/templates/koji.conf.j2
Normal file
9
roles/koji_hub/templates/koji.conf.j2
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[koji]
|
||||
server = https://{{ koji_hub_fqdn }}/kojihub
|
||||
weburl = http://{{ koji_hub_fqdn }}/koji
|
||||
topurl = http://{{ koji_hub_fqdn }}/kojifiles
|
||||
topdir = {{ koji_top_dir }}
|
||||
cert = ~/.koji/client.pem
|
||||
key = /home/{{ koji_admin_user }}/.koji/client.key
|
||||
serverca = /home/{{ koji_admin_user }}/.koji/serverca.crt
|
||||
authtype = ssl
|
||||
18
roles/koji_hub/templates/koji_callbacks.py.j2
Normal file
18
roles/koji_hub/templates/koji_callbacks.py.j2
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
||||
def main():
|
||||
log_file = "/var/log/koji_callbacks.log"
|
||||
with open(log_file, "a") as f:
|
||||
f.write("Callback triggered:\n")
|
||||
f.write(f" Type: {os.environ.get('KOJI_TYPE')}\n")
|
||||
f.write(f" Table: {os.environ.get('KOJI_TABLE')}\n")
|
||||
f.write(f" ID: {os.environ.get('KOJI_ID')}\n")
|
||||
f.write(f" Attrs: {os.environ.get('KOJI_ATTRS')}\n")
|
||||
f.write("\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
26
roles/koji_hub/templates/koji_cleanup.sh.j2
Normal file
26
roles/koji_hub/templates/koji_cleanup.sh.j2
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Koji cleanup script
|
||||
# This script cleans up old build roots and work directories on the Koji hub.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Configuration ---
|
||||
KOJI_TOP_DIR="{{ koji_top_dir }}"
|
||||
KOJI_ADMIN_USER="{{ koji_admin_user }}"
|
||||
ADMIN_USER_KOJI_DIR="{{ koji_hub_admin_user_koji_dir }}"
|
||||
|
||||
# --- Main Script ---
|
||||
|
||||
echo "$(date): Starting Koji cleanup..."
|
||||
|
||||
# Clean up old build roots
|
||||
# koji-gc --cleanup-buildroots --debug
|
||||
|
||||
# Clean up old work directories
|
||||
# find "$KOJI_TOP_DIR/work" -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;
|
||||
|
||||
# Example: Remove old scratch builds (older than 30 days)
|
||||
# koji --config="$ADMIN_USER_KOJI_DIR/config" list-builds --state=FAILED --state=CANCELED --state=DELETED --mine --after-completion="$(date -d '30 days ago' +%Y-%m-%d)" | awk '{print $1}' | xargs -r -L 1 koji --config="$ADMIN_USER_KOJI_DIR/config" remove-build --nowait
|
||||
|
||||
echo "$(date): Koji cleanup finished."
|
||||
2
roles/koji_hub/templates/policies.conf.j2
Normal file
2
roles/koji_hub/templates/policies.conf.j2
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[hub-policy:admin]
|
||||
user = {{ koji_admin_user }}
|
||||
10
roles/koji_hub/templates/web.conf.j2
Normal file
10
roles/koji_hub/templates/web.conf.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[web]
|
||||
SiteName = MxOS koji
|
||||
KojiHubURL = https://{{ koji_hub_fqdn }}/kojihub
|
||||
KojiFilesURL = https://{{ koji_hub_fqdn }}/kojifiles
|
||||
WebAuthType = ssl
|
||||
LoginTimeout = 72
|
||||
Secret = {{ web_secret }}
|
||||
LibPath = /usr/share/koji-web/lib
|
||||
serverca = {{ koji_remote_ca_trust_path }}
|
||||
LiteralFooter = True
|
||||
Loading…
Reference in a new issue