summaryrefslogtreecommitdiff
path: root/frontends/Rexfile
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-31 15:36:33 +0200
committerPaul Buetow <paul@buetow.org>2026-01-31 15:36:33 +0200
commit678dbd8f6c0e581e185a527e9d380546dd8fb205 (patch)
treebd1a13a92648dfc1eee7c33b14b28d0a62fd9979 /frontends/Rexfile
parent9f0c3ca6d45b99db5523cff05f39fb968febac6d (diff)
fix: relayd template and missing ipv4address variable
- Fixed Perl template syntax error in relayd.conf.tpl (lines 68-77) with improperly nested if/elsif blocks - Added ipv4address subroutine to Rexfile to lookup IPv4 by hostname - Updated relayd template to use ipv4address->($hostname) instead of undefined $vio0_ip variable - Pass ipv4address to template engine in relayd task Amp-Thread-ID: https://ampcode.com/threads/T-019c1441-7e3a-77cd-890f-cd31df998a31 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'frontends/Rexfile')
-rw-r--r--frontends/Rexfile12
1 files changed, 12 insertions, 0 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile
index 11ce519..ba5238b 100644
--- a/frontends/Rexfile
+++ b/frontends/Rexfile
@@ -46,6 +46,17 @@ $ips{current_master}{fqdn} = 'fishfinger.' . $ips{domain};
$ips{current_standby} = $ips{blowfish};
$ips{current_standby}{fqdn} = 'blowfish.' . $ips{domain};
+# Gather IPv4 addresses based on hostname.
+our $ipv4address = sub {
+ my $hostname = shift;
+ my $ip = $ips{$hostname}{ipv4};
+ unless ( defined $ip ) {
+ Rex::Logger::info( "Unable to determine IPv4 address for $hostname", 'error' );
+ return '127.0.0.1';
+ }
+ return $ip;
+};
+
# Gather IPv6 addresses based on hostname.
our $ipv6address = sub {
my $hostname = shift;
@@ -313,6 +324,7 @@ task 'relayd',
file '/etc/relayd.conf',
content => template(
'./etc/relayd.conf.tpl',
+ ipv4address => $ipv4address,
ipv6address => $ipv6address,
f3s_hosts => \@f3s_hosts,
acme_hosts => \@acme_hosts