On Wed, Feb 10, 2021 at 03:01:44PM +0000, Chris Green wrote:
> Local hostname doesn't have FQDN by default though:-
>
> chris@isbdGandi$ hostname
> isbdGandi
> chris@isbdGandi$ hostname -f
> isbdGandi.isbd.uk
>
> > Do your OS instances have their hostnames?
>
> See above.
The simplest solution is to arrange for the systems to instead have
fully-qualified hostnames. This will likely have additional benefits
down the line.
If, for some reason, that is not something you're willing/able to do,
then you can use "make" to construct the "main.cf" file for each host,
distributing instead a "Makefile" and a "main.cf.in":
Makefile:
main.cf: main.cf.in
mkdir -p staged
cp main.cf.in staged/main.cf
domain=`domainname` && postconf -c `pwd`/staged
mydomain=$$domain
if ! cmp -s staged/main.cf main.cf; then mv staged/main.cf
main.cf; fi
main.cf.in:
# whatever
...
Deployment command: "umask 022; cd /etc/postfix; make". You can even do
something similar for deploying multi-instance configurations, by
iterating "make" over each instance.
--
Viktor.