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,2 @@
---
koji_db_network: "192.168.122.0/24"
postgresql_koji_db_network: 192.168.1.0/24

View file

@ -1,36 +1,22 @@
---
#SPDX-License-Identifier: MIT-0
# SPDX-License-Identifier: MIT-0
galaxy_info:
author: your name
description: your role description
company: your company (optional)
author: "Renich Bon Ciric"
description: "PostgreSQL server"
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,4 +1,4 @@
#SPDX-License-Identifier: MIT-0
# SPDX-License-Identifier: MIT-0
---
- name: Install PostgreSQL packages
ansible.builtin.dnf:
@ -43,34 +43,24 @@
state: started
enabled: true
- name: Configure PostgreSQL settings
community.postgresql.postgresql_set:
name: "{{ item.name }}"
value: "{{ item.value }}"
- name: Configure PostgreSQL settings for SSL and listening
ansible.builtin.lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: "^{{ item.regexp }}"
line: "{{ item.line }}"
state: present
backup: true
loop:
- { name: 'ssl_ca_file', value: 'ca.crt' }
- { name: 'ssl', value: 'on' }
- { name: 'ssl_cert_file', value: 'server.crt' }
- { name: 'ssl_key_file', value: 'server.key' }
- { name: 'max_connections', value: '200' }
- { name: 'listen_addresses', value: '*' }
- { regexp: '#?ssl\\s*=\\s*.*', line: "ssl = on" }
- { regexp: '#?ssl_cert_file\\s*=\\s*.*', line: "ssl_cert_file = 'server.crt'" }
- { regexp: '#?ssl_key_file\\s*=\\s*.*', line: "ssl_key_file = 'server.key'" }
- { regexp: '#?ssl_ca_file\\s*=\\s*.*', line: "ssl_ca_file = 'ca.crt'" }
- { regexp: '#?listen_addresses\\s*=\\s*.*', line: "listen_addresses = '*'" }
- { regexp: '#?max_connections\\s*=\\s*.*', line: "max_connections = 200" }
become: true
become_user: postgres
notify: Restart postgresql
- name: Remove old pg_hba.conf entry for Koji hub (IPv4 network)
community.postgresql.postgresql_pg_hba:
dest: /var/lib/pgsql/data/pg_hba.conf
contype: hostssl
databases: "{{ koji_db_name }}"
users: "{{ koji_db_user }}"
address: "{{ koji_db_network }}"
method: scram-sha-256
state: absent
notify: Restart postgresql
- name: Configure pg_hba.conf to allow connection from the Koji hub (IPv4 address)
community.postgresql.postgresql_pg_hba:
dest: /var/lib/pgsql/data/pg_hba.conf

View file

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

View file

@ -1,3 +1,3 @@
#SPDX-License-Identifier: MIT-0
# SPDX-License-Identifier: MIT-0
---
# vars file for roles/postgresql