1
0
Fork 0
forked from infra/ansible

Derive Log Detective credentials from securely stored values

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
This commit is contained in:
Jiri Podivin 2026-07-08 15:29:26 +02:00 committed by Pavel Raiskup
commit ffca0313f5
3 changed files with 90 additions and 0 deletions

View file

@ -2,3 +2,8 @@
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: true
- name: Restart Log Detective
ansible.builtin.systemd:
name: logdetective.service
state: restarted

View file

@ -170,6 +170,39 @@
- http
- https
# Log Detective needs certificates in a location that will be mounted
# by the containerized service, not in the standar location where
# the `messaging` role places them
- name: Install Fedmsg certificates
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "/root/logdetective/fedora_messaging_certs/{{ item.file }}"
owner: root
group: root
mode: '0600'
with_items:
- src: "{{private}}/files/rabbitmq/{{env}}/pki/issued/logdetective-packit{{ env_suffix }}.crt"
file: logdetective-packit-cert.pem
- src: "{{private}}/files/rabbitmq/{{env}}/pki/private/logdetective-packit{{ env_suffix }}.key"
file: logdetective-packit-key.pem
notify:
- Restart Log Detective
tags:
- logdetective_credentials
- config
- name: Render Log Detective env_file
ansible.builtin.template:
src: env_file.j2
dest: /root/logdetective/env_file
mode: '0600'
notify:
- Restart Log Detective
tags:
- config
- logdetective_credentials
- name: Install logdetective systemd service
ansible.builtin.copy:
src: logdetective.service

View file

@ -0,0 +1,52 @@
# From env_file of https://github.com/fedora-copr/logdetective
# The default env_file will be overriden in production with this rendered template
# compose sources this file
# docs: https://docs.docker.com/compose/environment-variables/set-environment-variables/
# Determines whether or not to use developer or production mode
# used by `files/run_server.sh`
ENV="production"
# On which port should Log Detective listen
LOGDETECTIVE_SERVER_PORT=443
LOGDETECTIVE_CERTDIR="/src/server/"
# Port of inference server both in container and on host
INFERENCE_SERVER_PORT=8100
# Port to common proxy of inference server containers
INFERENCE_PROXY_PORT=8000
# Path to Logdetective server configuration file
LOGDETECTIVE_SERVER_CONF="/config.yml"
# Path to prompt templates for Log Detective
LOGDETECTIVE_PROMPT_TEMPLATES="/src/logdetective/prompts"
# Path to patterns to be skipped during processing
LOGDETECTIVE_SKIP_PATTERNS="/src/logdetective/skip_snippets.yml"
# Authentication token for Log Detective API
{% if logdetective_token is defined %}
LOGDETECTIVE_TOKEN="{{ logdetective_token }}"
{% endif %}
# Database
POSTGRESQL_USER=logdetective
POSTGRESQL_PASSWORD="{{ log_detective_db_password }}"
POSTGRESQL_DATABASE=logdetective
POSTGRESQL_PORT=5432
SQLALCHEMY_ECHO=0
# logdetective-packit interface server github.com/fedora-copr/logdetective-packit
# Set to value assuming container deployment on the same node
LD_URL=https://logdetective01.fedorainfracloud.org/analyze
# Only when the Log Detective server itself has `LOGDETECTIVE_TOKEN` variable set
{% if logdetective_token is defined %}
LD_TOKEN="{{ logdetective_token }}"
{% endif %}
# Token for logdetective packit server, allowing access to the `/analyze` API.
# This token must not be the same as `LOGDETECTIVE_TOKEN` and `LD_TOKEN`.
{% if logdetective_packit_token is defined %}
LD_PACKIT_TOKEN="{{ logdetective_packit_token }}"
{% endif %}
{% if logdetective_packit_interface_sentry is defined %}
LD_PACKIT_INTERFACE_SENTRY_DSN="{{ logdetective_packit_interface_sentry }}"
{% endif %}
LD_TIMEOUT=3017