feat: Mejorar la configuración y seguridad de Koji
Este commit introduce varias mejoras en los roles de Ansible para Koji: - **Rol koji_hub:** - Se reemplazó `lineinfile` con una plantilla completa para `hub.conf` para mejorar la legibilidad y mantenibilidad. - Se aseguró la instalación del paquete `python3-koji-hub-plugins` para soportar el plugin `echo`. - Se eliminó una tarea `blockinfile` redundante que duplicaba la configuración de la base de datos en `hub.conf`. - Se rehabilitó el plugin `echo` en `hub.conf` después de asegurar su disponibilidad. - **Rol postgresql:** - Se modificó la configuración de `pg_hba.conf` para iterar correctamente sobre todos los hosts en el grupo `kojihub`, asegurando que todas las instancias del hub puedan conectarse a la base de datos. - **Rol dist_git:** - Se implementó el etiquetado persistente de contextos SELinux para los directorios de `dist-git` usando `semanage fcontext` y `restorecon`, asegurando que los contextos persistan tras reetiquetados del sistema de archivos. - **Rol common:** - Se mejoró la seguridad en la generación de claves GPG usando un archivo temporal para el script por lotes, el cual se elimina de forma segura después de la generación de la clave. - **Configuración Global:** - Se introdujo la variable `koji_source_script_path` en `vars/default.yaml` para centralizar la ruta del script `mxos-get-sources.bash`, eliminando rutas hardcodeadas en `kojid_allowed_scms` y las tareas de `kojid`. - **Documentación:** - Se actualizó `docs/instalación.rst` para reflejar los cambios en la configuración de Dist-Git, plugins y variables.
This commit is contained in:
parent
39aeb2d6b6
commit
f14c01da0b
25 changed files with 731 additions and 123 deletions
|
|
@ -76,19 +76,43 @@
|
|||
--config={{ koji_hub_admin_user_koji_dir }}/config
|
||||
add-external-repo -t {{ koji_build_tag }}-build centos-stream-10-epel
|
||||
https://mirror.facebook.net/fedora/epel/10/Everything/x86_64/
|
||||
register: koji_bootstrap_add_appstream_repo_result
|
||||
changed_when: "'External repository created' in koji_bootstrap_add_appstream_repo_result.stdout"
|
||||
failed_when: "koji_bootstrap_add_appstream_repo_result.rc != 0 and 'already exists' not in koji_bootstrap_add_appstream_repo_result.stderr"
|
||||
register: koji_bootstrap_add_epel_repo_result
|
||||
changed_when: "'External repository created' in koji_bootstrap_add_epel_repo_result.stdout"
|
||||
failed_when: "koji_bootstrap_add_epel_repo_result.rc != 0 and 'already exists' not in koji_bootstrap_add_epel_repo_result.stderr"
|
||||
|
||||
- name: Add Koji builder hosts
|
||||
- name: Download repomd.xml from CentOS Stream 10 build repo
|
||||
ansible.builtin.get_url:
|
||||
url: https://kojihub.stream.centos.org/kojifiles/repos/c10s-build/latest/x86_64/repodata/repomd.xml
|
||||
dest: /tmp/c10s-repomd.xml
|
||||
|
||||
- name: Extract comps.xml path
|
||||
ansible.builtin.shell: grep 'comps.xml"' /tmp/c10s-repomd.xml | head -n 1 | sed -e 's/.*href="//' -e 's/".*//'
|
||||
register: comps_path
|
||||
changed_when: false
|
||||
|
||||
- name: Download comps.xml
|
||||
ansible.builtin.get_url:
|
||||
url: "https://kojihub.stream.centos.org/kojifiles/repos/c10s-build/latest/x86_64/{{ comps_path.stdout }}"
|
||||
dest: /tmp/c10s-comps.xml
|
||||
|
||||
- name: Import comps groups
|
||||
ansible.builtin.command: >
|
||||
sudo -u {{ koji_admin_user }} koji
|
||||
--config={{ koji_hub_admin_user_koji_dir }}/config
|
||||
add-host {{ item }} x86_64
|
||||
import-comps /tmp/c10s-comps.xml {{ koji_build_tag }}-build
|
||||
register: koji_bootstrap_import_comps_result
|
||||
changed_when: "'Groups imported' in koji_bootstrap_import_comps_result.stdout"
|
||||
|
||||
- name: Add Koji builder hosts
|
||||
ansible.builtin.include_tasks: add_host.yaml
|
||||
loop: "{{ groups['kojibuilders'] }}"
|
||||
register: koji_bootstrap_add_host_result
|
||||
changed_when: "'Host added' in koji_bootstrap_add_host_result.stdout"
|
||||
failed_when: "koji_bootstrap_add_host_result.rc != 0 and 'is already in the database' not in koji_bootstrap_add_host_result.stderr"
|
||||
|
||||
- name: Restart httpd on kojihub to apply Koji changes
|
||||
ansible.builtin.service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
delegate_to: "{{ groups['kojihub'][0] }}"
|
||||
run_once: true
|
||||
|
||||
- name: Add Koji builder hosts to createrepo channel
|
||||
ansible.builtin.command: >
|
||||
|
|
|
|||
Loading…
Reference in a new issue