Skip to content

Commit 495c33d

Browse files
committed
Specify the zone & only use the first DNS server
The hostnames can have dots in them so it's important to clarify which zone they belong to.
1 parent 8769a82 commit 495c33d

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

fragments/add_dns_record.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@ fi
2020

2121
HOSTNAME="$(hostname --fqdn)"
2222

23-
for DNS_SERVER in %DNS_SERVERS%; do
24-
# NOTE: the dot after the hostname is necessary
25-
/usr/local/bin/update_dns -s "$DNS_SERVER" -k "$DNS_UPDATE_KEY" "$HOSTNAME." "%IP_ADDRESS%"
26-
done
23+
# NOTE: the dot after the hostname is necessary
24+
/usr/local/bin/update_dns -z "%ZONE%" -s "%DNS_SERVER%" -k "$DNS_UPDATE_KEY" "$HOSTNAME." "%IP_ADDRESS%"

infra.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ resources:
411411
config:
412412
str_replace:
413413
params:
414-
'%DNS_SERVERS%': {list_join: [" ", {get_param: dns_servers}]}
414+
'%ZONE%': {get_param: domain_name}
415+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
415416
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
416417
'%IP_ADDRESS%': {get_attr: [port, fixed_ips, 0, ip_address]}
417418
template: {get_file: fragments/add_dns_record.sh}

loadbalancer_dedicated.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ resources:
339339
config:
340340
str_replace:
341341
params:
342-
'%DNS_SERVERS%': {list_join: [" ", {get_param: dns_servers}]}
342+
'%ZONE%': {get_param: domain_name}
343+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
343344
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
344345
'%IP_ADDRESS%': {get_param: floatingip}
345346
template: {get_file: fragments/add_dns_record.sh}

master.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ resources:
403403
config:
404404
str_replace:
405405
params:
406-
'%DNS_SERVERS%': {list_join: [" ", {get_param: dns_servers}]}
406+
'%ZONE%': {get_param: domain_name}
407+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
407408
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
408409
'%IP_ADDRESS%': {get_attr: [port, fixed_ips, 0, ip_address]}
409410
template: {get_file: fragments/add_dns_record.sh}

node.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ resources:
514514
config:
515515
str_replace:
516516
params:
517-
'%DNS_SERVERS%': {list_join: [" ", {get_param: dns_servers}]}
517+
'%ZONE%': {get_param: domain_name}
518+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
518519
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
519520
'%IP_ADDRESS%': {get_attr: [port, fixed_ips, 0, ip_address]}
520521
template: {get_file: fragments/add_dns_record.sh}

0 commit comments

Comments
 (0)