From 452c7dc42e4ebd6eebfcb9da855416e08bf576c6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 19 Sep 2026 00:28:54 +0200 Subject: [PATCH] feat(storage): let the NFS source differ for the controller The controller reaches the export on its own address. Once a VPN joins the cluster and the controller is not a member, the server's mesh address is unroutable from there, so one source cannot serve both. Opt-in through a term, so every existing caller keeps the single-address behaviour and only the controller mount asks for the other one. --- plugins/lookup/nfs_client_src.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/nfs_client_src.py b/plugins/lookup/nfs_client_src.py index 513a086e84..5581309283 100644 --- a/plugins/lookup/nfs_client_src.py +++ b/plugins/lookup/nfs_client_src.py @@ -13,13 +13,22 @@ from utils.storage.nfs import ( class LookupModule(LookupBase): - """NFS client mount src (server:path): {{ lookup('nfs_client_src') }}.""" + """NFS client mount src (server:path): {{ lookup('nfs_client_src') }}. + + Pass ``controller`` to address the server as the Ansible controller must + reach it: ``{{ lookup('nfs_client_src', 'controller') }}``. Where the + cluster is joined by a VPN the controller is not a member of, the two are + different addresses, and the controller can only use the underlay one. + """ def run(self, terms, variables=None, **kwargs): variables = variables or getattr(self._templar, "available_variables", {}) or {} nfs = variables.get("storage", {}).get("nfs", {}) + server = nfs.get("server") + if terms and terms[0] == "controller": + server = nfs.get("controller_server") or server flavor = lookup_loader.get( "nfs_flavor", loader=self._loader, templar=self._templar ).run([], variables=variables)[0] state = state_path(get_export_base(), STATE_SUBDIR) - return [client_src(nfs.get("server"), get_client_version(), flavor, state)] + return [client_src(server, get_client_version(), flavor, state)]