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 <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
664a544aa9
commit
1ec315d96c
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user