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:
Rénich Bon Ćirić 2025-11-15 20:07:11 -06:00
commit 39aeb2d6b6
Signed by: renich
GPG key ID: AB2A9F49384FE324
91 changed files with 1037 additions and 957 deletions

View file

@ -1,2 +1,5 @@
---
kojid_work_dir: /var/lib/kojid
kojid_work_dir: /var/lib/kojid
kojid_allowed_scms: git.mx-os.mx:/RPMs/*
kojid_use_host_resolv: true
kojid_max_jobs: 50

View file

@ -1,5 +1,10 @@
config_opts['root'] = '{{ kojid_mock_root }}'
config_opts['releasever'] = '10'
config_opts['rpmbuild_networking'] = True
config_opts['use_bootstrap'] = False
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install rpm-build rpmdevtools rpmlint'
config_opts['yum.conf'] = """
[main]
gpgcheck=1
@ -8,6 +13,7 @@ keepcache=1
reposdir=/dev/null
retries=20
strict=1
sslverify=0
[baseos]
name=CentOS Stream 10 - BaseOS
@ -24,5 +30,10 @@ name=CentOS Stream 10 - CRB
baseurl=https://mirror.stream.centos.org/10-stream/CRB/x86_64/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256
enabled=1
[epel]
name=Extra Packages for Enterprise Linux 10 - x86_64
baseurl=https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-epel-10
enabled=1
"""
config_opts['chroot_setup_cmd'] = 'install rpm-build rpmdevtools rpmlint'

View file

@ -1,4 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
- name: Restart kojid
ansible.builtin.service:

View file

@ -1,36 +1,22 @@
# SPDX-License-Identifier: MIT-0
---
galaxy_info:
author: your name
description: your role description
company: your company (optional)
author: "Renich Bon Ciric"
description: "Koji builder"
company: "Mx-OS"
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
license: "GPL-2.0-or-later"
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: "2.15"
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
platforms:
- name: Fedora
versions:
- "40"
- name: EL
versions:
- "10"
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View file

@ -1,6 +1,16 @@
---
- name: Install Koji-Builder packages and rpm-build
- name: Enable CodeReady Builder (CRB) repository
ansible.builtin.command: dnf config-manager --set-enabled crb
args:
creates: /etc/yum.repos.d/centos-stream-crb.repo
- name: Install EPEL repository
ansible.builtin.dnf:
name: epel-release
state: present
- name: Install Koji-Builder packages, rpm-build, and koji CLI
ansible.builtin.dnf:
name:
- koji-builder
@ -8,6 +18,8 @@
- rpmdevtools
- mock
- policycoreutils-python-utils
- git
- koji
state: present
- name: Create kojid work directory
@ -32,11 +44,12 @@
group: mock
mode: "2775"
- name: Configure mock site defaults
ansible.builtin.template:
src: site-defaults.cfg.j2
dest: /etc/mock/site-defaults.cfg
- name: Copy mock configuration file
ansible.builtin.copy:
src: mxos0-build-x86_64.cfg
dest: /etc/mock/mxos0-build-x86_64.cfg
mode: "0644"
notify: restart kojid
- name: Configure kojid
ansible.builtin.template:
@ -77,6 +90,13 @@
group: root
mode: "0600"
- name: Configure Koji client on builder
ansible.builtin.template:
src: roles/koji_hub/templates/koji.conf.j2
dest: /etc/koji.conf.d/ansible-settings.conf
mode: "0644"
- name: Add hub host to /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
@ -86,16 +106,11 @@
- name: Update CA trust
ansible.builtin.command: update-ca-trust
changed_when: false
check_mode: false
- name: Start and enable kojid service
ansible.builtin.service:
name: kojid
state: started
enabled: true
- name: Add koji hub to /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ hostvars[groups['kojihub'][0]].ansible_default_ipv4.address }} {{ koji_hub_fqdn }}"
regexp: ".*{{ koji_hub_fqdn }}"
state: present

View file

@ -1,6 +1,7 @@
# SPDX-License-Identifier: MIT-0
---
- hosts: localhost
- name: Test kojid role
hosts: localhost
remote_user: root
roles:
- roles/kojid
- kojid