From 1ec315d96c826e43c522e571718574cc2f86d888 Mon Sep 17 00:00:00 2001 From: Ruslan Petrovich Date: Wed, 24 Jun 2026 21:31:53 +0300 Subject: [PATCH] Align Postfix identity with system hostname on PMG nodes. Add an idempotent baseline step that enforces myhostname/mydomain from hostname -f and reloads postfix only when drift is detected. Co-authored-by: Cursor --- pmg/pmg_baseline.sls | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pmg/pmg_baseline.sls b/pmg/pmg_baseline.sls index eecfe6d..50ddcf7 100644 --- a/pmg/pmg_baseline.sls +++ b/pmg/pmg_baseline.sls @@ -17,6 +17,21 @@ pmg-cluster-status: cmd.run: - name: pmgcm status +pmg-postfix-identity-from-system-hostname: + cmd.run: + - name: >- + HN="$(hostname -f)" && + DM="${HN#*.}" && + postconf -e "myhostname=${HN}" "mydomain=${DM}" && + systemctl reload postfix + - unless: >- + HN="$(hostname -f)" && + DM="${HN#*.}" && + [ "$(postconf -h myhostname)" = "${HN}" ] && + [ "$(postconf -h mydomain)" = "${DM}" ] + - require: + - service: pmg-service-postfix + {% if manage_hosts_file %} pmg-managed-hosts: file.blockreplace: