mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
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.
This commit is contained in:
1 file changed
+11
-2
@@ -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)]
|
||||
Reference in new issue
Block a user