Install multiple panels and shared receivers from one inventory

This commit is contained in:
parkel committed 2026-11-26 22:10:34 +01:00
1 parent 0ade3ac001
commit 082f601f2a
12 files changed
+1361 -93

No files matched your search

+20 -7
View File
@@ -23,6 +23,10 @@ from .engine import root_file, run
from .terminal import PlainTerminal, PreviousStepError
class ClusterRequestedError(Exception):
pass
def ask_checked(terminal, label, default, validate, *, hint=""):
while True:
value = terminal.prompt(label, str(default), hint=hint)
@@ -46,8 +50,9 @@ class InteractiveSetup:
}
SECTIONS = ("topology", "panel", "admin", "dns", "mail", "hosting", "back")
def __init__(self, terminal):
def __init__(self, terminal, *, offer_cluster=False):
self.terminal = terminal
self.offer_cluster = offer_cluster
self.answers = {}
self.profile = "full-service"
self.data = {}
@@ -69,9 +74,17 @@ class InteractiveSetup:
" Distributed starts with separate DNS and mail nodes. "
"Run setup on each panel server."
)
profiles = tuple(self.PROFILES)
if self.offer_cluster:
self.terminal.show(
"Cluster prepares multiple panel servers in one run."
)
profiles += ("cluster",)
profile = self.terminal.choose(
"Deployment profile", self.PROFILES, self.profile
"Deployment profile", profiles, self.profile
)
if profile == "cluster":
raise ClusterRequestedError
for name, hint in (
("dns", guidance.DNS_ROLE),
("mail", guidance.MAIL_ROLE),
@@ -96,7 +109,7 @@ class InteractiveSetup:
self.data[name] = fields | {"mode": mode}
self.profile = profile
def panel(self):
def panel(self, *, remote=False):
self.terminal.heading("Panel and HTTPS")
panel = {
"hostname": self.ask(
@@ -114,7 +127,7 @@ class InteractiveSetup:
),
}
if panel["access"] == "tls":
panel.update(self.certificates("panel", "panel", remote=False))
panel.update(self.certificates("panel", "panel", remote=remote))
elif panel["access"] == "proxy":
for field, label, hint in (
(
@@ -163,7 +176,7 @@ class InteractiveSetup:
def certificates(self, section, service, *, remote):
fields = self.data.get(section, {})
where = " on the mail node" if remote else " on this server"
where = " on the destination" if remote else " on this server"
while True:
paths = {
field: ask_checked(
@@ -449,9 +462,9 @@ def check_remote_role(name, target, terminal):
) from error
def interactive_plan(terminal=None):
def interactive_plan(terminal=None, *, offer_cluster=False):
terminal = terminal or PlainTerminal()
setup = InteractiveSetup(terminal)
setup = InteractiveSetup(terminal, offer_cluster=offer_cluster)
setup.collect()
while True:
try: