Mercurial > repos > other > Puppet
diff manifests/templates.pp @ 302:01d1b0f6dbaf
Fix more IPv4 vs IPv6 settings
Postfix wouldn't look up "localhost" but accepts IPs
Checking for the existance of "ipaddress" covers us for now as a
work-around, because IPv6-only doesn't have "ipaddress" but "IPv4
with IPv6 link-local" does have "ipaddress6"
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 17 Feb 2020 19:45:46 +0000 |
parents | 1bfc290270cc |
children | 7fa5e230fc94 |
line wrap: on
line diff
--- a/manifests/templates.pp Mon Feb 17 18:45:06 2020 +0000 +++ b/manifests/templates.pp Mon Feb 17 19:45:46 2020 +0000 @@ -42,10 +42,14 @@ } #VPS is a self-mastered Puppet machine, so bodge a Hosts file + if $primary_ip =~ Stdlib::IP::Address::V6 { + $lo_ip = '::1' + } else { + $lo_ip = '127.0.0.1' + } file { '/etc/hosts': ensure => present, - content => "127.0.0.1 localhost -$primary_ip ${fqdn}", + content => "${lo_ip} localhost\n${primary_ip} ${fqdn}", } require repos @@ -706,7 +710,7 @@ ){ class { 'postfix': mailserver => $mailserver, - protocols => 'ipv4', + protocols => has_key($facts, 'ipaddress') ? { true => 'ipv4', default => 'ipv6' }, } class { 'dovecot': imapserver => $imapserver,