Skip to content

Commit 6971cdc

Browse files
Copilotvitabaks
andcommitted
Fix TLS certificate SAN field to use service-specific bind addresses
Co-authored-by: vitabaks <[email protected]>
1 parent a63a087 commit 6971cdc

File tree

1 file changed

+8
-1
lines changed
  • automation/roles/tls_certificate/tasks

1 file changed

+8
-1
lines changed

automation/roles/tls_certificate/tasks/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
(
8282
tls_hosts | map('extract', hostvars, 'ansible_hostname') | map('regex_replace', '^', 'DNS:') | list +
8383
tls_hosts | map('extract', hostvars, 'ansible_fqdn') | map('regex_replace', '^', 'DNS:') | list +
84-
tls_hosts | map('extract', hostvars, 'bind_address') | map('regex_replace', '^', 'IP:') | list +
84+
tls_hosts | map('extract', hostvars, tls_bind_address_var) | map('regex_replace', '^', 'IP:') | list +
8585
['DNS:localhost', 'IP:127.0.0.1']
8686
) | unique | join(',')
8787
}}
@@ -92,6 +92,13 @@
9292
if (tls_group_name | default('') | length > 0 and tls_group_name in groups)
9393
else ansible_play_hosts
9494
}}
95+
tls_bind_address_var: >-
96+
{{
97+
'etcd_bind_address' if tls_group_name | default('') == 'etcd_cluster'
98+
else 'consul_bind_address' if tls_group_name | default('') == 'consul_instances'
99+
else 'patroni_bind_address' if tls_group_name | default('') == 'postgres_cluster'
100+
else 'bind_address'
101+
}}
95102
when: tls_subject_alt_name | default('') | length < 1
96103

97104
- name: "Display Certificate subjectAltName future value"

0 commit comments

Comments
 (0)