Skip to content

TLS cert-generation is triplicated in rotate-certs.yml — extract to one shared task file (DRY) #12181

Description

@mrveiss

The self-signed cert generation logic is not "one of a kind": ansible/playbooks/rotate-certs.yml copy-pastes an identical openssl req -x509 -nodes -days … -newkey rsa:2048 -keyout … -out … -subj … task plus its 0600 root:root key-permissions task three times — once each for the slm (L100), backend (L190), and frontend (L268) plays. Only the per-node vars (_key_file/_cert_file/_cert_subject/_cert_days) differ, and those are already set per play.

The repo already established the shared-TLS-task convention in #7272 (ansible/_shared/tasks/stat_tls_certs.yml, included by the backend + redis roles). Cert generation should follow the same pattern.

Audit result (not duplicated — distinct purposes, leave as-is)

Fix

Extract the identical generate + set-permissions pair into ansible/_shared/tasks/generate_self_signed_cert.yml (consumers set _key_file/_cert_file/_cert_subject/_cert_days + a cert_label), and replace the three inline copies in rotate-certs.yml with include_tasks. Behavior-preserving.

Acceptance

  • One shared cert-gen task file; rotate-certs.yml includes it 3× (no inline openssl duplication)
  • yaml.safe_load valid; rotate-certs.yml behavior unchanged (same openssl invocation per node)

Activity

  1. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

    PR #12182 (merged to Dev_new_gui) references this issue with a close keyword.

    refactor(deploy): TLS cert-gen one-of-a-kind — extract triplicated block to shared task (#12181)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Jul 23, 2026

    @mrveiss
    OwnerAuthor

    Fixed in PR #12182 (merged to Dev_new_gui, 2026-07-23). Extracted the triplicated self-signed cert-generation into ansible/_shared/tasks/generate_self_signed_cert.yml; rotate-certs.yml now include_tasks it 3× (net −39 lines, zero inline openssl duplication). enable-tls/deploy-certificate/distribute-tls-certs left as-is (distinct lifecycle ops).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions