Add etcd TLS certificate upload support to gateway_server role - #35
Open
mazam32-itential wants to merge 1 commit into
Open
mazam32-itential wants to merge 1 commit into
mazam32-itential wants to merge 1 commit into
Conversation
upload_certs.yml previously only copied the main Gateway PKI certs (CA, cert, key). When etcd TLS is enabled with client cert auth (gateway_server_store_etcd_client_cert_auth: true), etcd-specific certificates had to be manually placed on target hosts before running the deployer, breaking its self-contained install model. Add three new source variables (gateway_server_store_etcd_ca_cert_src, gateway_server_store_etcd_cert_src, gateway_server_store_etcd_key_src), undefined by default, and new copy tasks in upload_certs.yml gated on gateway_server_store_etcd_use_tls / gateway_server_store_etcd_client_cert_auth and each source var being set. The existing destination variables (gateway_server_store_etcd_ca_certificate_filename, gateway_server_store_etcd_certificate_filename, gateway_server_store_etcd_private_key_filename) keep their names, but their default value is now conditional: if the matching *_src var is set, it resolves to a new dedicated path (etcd-ca.crt/etcd-client.crt/ etcd-client.key under the same PKI directory); otherwise it falls back to the existing shared-with-main-Gateway-PKI path, unchanged. This avoids a customer who supplies a distinct etcd CA silently overwriting the main Gateway mTLS cert file, without requiring anyone who isn't using this feature to change anything. Tested by: - Loading the role's defaults directly (via include_vars, no live host needed) and confirming the three destination variables resolve correctly in three cases: no *_src set (matches today's shared paths exactly - e.g. /etc/gateway/ssl/ca.crt), all three *_src set (resolves to the new dedicated paths - etcd-ca.crt/etcd-client.crt/ etcd-client.key), and a partial case (only the CA source set, confirming each of the three destination variables is independent). This caught a real bug in the first draft: using `is defined` alone (instead of `is not none`) to gate the conditional always evaluated true, because the *_src variables are declared (as null) in defaults - meaning the dedicated path was always selected regardless of whether a customer actually set a source. Fixed by switching to `is not none`. - Running the actual upload_certs.yml task file (via include_tasks, not a reimplementation) against localhost with dummy cert files, confirming: main Gateway PKI and Connect cert copies correctly skip when their source vars are unset; all three etcd files are copied with correct destination paths, correct permissions (0444/0644/0400), and byte-identical content to the source files. - Confirmed the "TLS disabled" and "TLS enabled without client cert auth" gates independently: with gateway_server_store_etcd_use_tls false, nothing is uploaded; with client_cert_auth false, only the CA cert is uploaded and the client cert/key tasks skip. - ansible-lint on both changed task/defaults files passes clean (0 failures, 0 warnings).
kvelarde-itential
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
upload_certs.ymlpreviously only copied the main Gateway PKI certs (CA, cert, key). When etcd TLS is enabled with client cert auth (gateway_server_store_etcd_client_cert_auth: true), etcd-specific certificates had to be manually placed on target hosts before running the deployer, breaking its self-contained install model.gateway_server_store_etcd_ca_cert_src,gateway_server_store_etcd_cert_src,gateway_server_store_etcd_key_src(undefined by default).upload_certs.yml, gated ongateway_server_store_etcd_use_tls/gateway_server_store_etcd_client_cert_authand each source variable being set.gateway_server_store_etcd_ca_certificate_filename,gateway_server_store_etcd_certificate_filename,gateway_server_store_etcd_private_key_filename) keep their names, but their default value is now conditional: if the matching*_srcvar is set, it resolves to a new dedicated path (etcd-ca.crt/etcd-client.crt/etcd-client.keyunder the same PKI directory); otherwise it falls back to the existing shared-with-main-Gateway-PKI path, unchanged. This avoids a customer who supplies a distinct etcd CA silently overwriting the main Gateway mTLS cert file, with no action required from anyone not using this feature.docs/reference_guide.mdandCLAUDE.md.How this was tested
Defaults resolution (via
include_vars, no live host needed) — confirmed the three destination variables resolve correctly in three cases:*_srcset → matches today's shared paths exactly (e.g./etc/gateway/ssl/ca.crt)*_srcset → resolves to the new dedicated paths (etcd-ca.crt/etcd-client.crt/etcd-client.key)This caught a real bug in the first draft: using
is definedalone (instead ofis not none) to gate the conditional always evaluated true, because the*_srcvariables are declared (asnull) in defaults — meaning the dedicated path was always selected regardless of whether a customer actually set a source. Fixed by switching tois not none.Actual task execution — ran the real
upload_certs.ymlfile (viainclude_tasks, not a reimplementation) againstlocalhostwith dummy cert files:0444/0644/0400), and byte-identical content to the source filesGating — confirmed independently:
gateway_server_store_etcd_use_tls: false→ nothing uploadedgateway_server_store_etcd_client_cert_auth: false→ only the CA cert uploaded, client cert/key tasks skipLint:
ansible-linton both changed task/defaults files passes clean (0 failures, 0 warnings).Test plan for reviewer
*_srcvariables see no behavior changeetcd-ca.crt,etcd-client.crt,etcd-client.key) are acceptable naming