From 8bb0c20276d9f7b76bcb744ac4f31863bda0c8b8 Mon Sep 17 00:00:00 2001 From: cliffmccarthy <16453869+cliffmccarthy@users.noreply.github.com> Date: Thu, 23 Oct 2025 13:35:26 -0500 Subject: [PATCH] refactor: Move addition of 9.9.9.9 resolver earlier - Moved the "Add 9.9.9.9 to resolv.conf" step earlier, before the creation of users or updates to any config files. This should not affect any of those operations. Moving this step earlier makes it easier to accommodate the restructuring of the deployment process into separate components with separate stages for install, configure, and activate. --- cmdeploy/src/cmdeploy/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index db049431..623403ab 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -683,6 +683,13 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None: check_config(config) mail_domain = config.mail_domain + if host.get_fact(Port, port=53) != "unbound": + files.line( + name="Add 9.9.9.9 to resolv.conf", + path="/etc/resolv.conf", + line="nameserver 9.9.9.9", + ) + server.group(name="Create vmail group", group="vmail", system=True) server.user(name="Create vmail user", user="vmail", group="vmail", system=True) server.group(name="Create opendkim group", group="opendkim", system=True) @@ -719,12 +726,6 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None: present=False, ) - if host.get_fact(Port, port=53) != "unbound": - files.line( - name="Add 9.9.9.9 to resolv.conf", - path="/etc/resolv.conf", - line="nameserver 9.9.9.9", - ) apt.update(name="apt update", cache_time=24 * 3600) apt.upgrade(name="upgrade apt packages", auto_remove=True)