diff --git a/tasks/cacert.yaml b/tasks/cacert.yaml index 0337327..14f1b7a 100644 --- a/tasks/cacert.yaml +++ b/tasks/cacert.yaml @@ -96,12 +96,22 @@ set_fact: patroni_server_subject_alt_names: "{{ groups[patroni_play_group] | default([]) | map('extract', hostvars, ['inventory_hostname']) | map('regex_replace', '^', 'DNS:') | list }}" + - name: Generate Patroni subject_alt_ips from patroni_cacert_force_append_ips + set_fact: + patroni_server_subject_alt_ips_force_append: "{{ patroni_cacert_force_append_ips | map('regex_replace', '^', 'IP:') | list }}" + when: patroni_cacert_force_append_ips is defined + + - name: Generate Patroni subject_alt_names from patroni_cacert_force_append_names + set_fact: + patroni_server_subject_alt_names_force_append: "{{ patroni_cacert_force_append_names | map('regex_replace', '^', 'DNS:') | list }}" + when: patroni_cacert_force_append_names is defined + - name: Generate an OpenSSL Certificate Signing Request for client community.crypto.openssl_csr: path: "{{ patroni_ssl_path }}/{{ patroni_self_signed_cert_name }}.csr" privatekey_path: "{{ patroni_ssl_path }}/{{ patroni_self_signed_cert_name }}.key" common_name: "{{ patroni_self_signed_cert_name }}" - subject_alt_name: "{{ patroni_server_subject_alt_ips | default([]) + patroni_server_subject_alt_names | default([]) + patroni_agent_subject_alt_ips | default([]) + patroni_agent_subject_alt_names | default([]) + patroni_server_subject_alt_ips_from_ansible_host | default([]) + patroni_server_subject_alt_ips_all_ipv4 | default([]) + patroni_agent_subject_alt_ips_from_ansible_host | default([]) }}" + subject_alt_name: "{{ patroni_server_subject_alt_ips | default([]) + patroni_server_subject_alt_names | default([]) + patroni_agent_subject_alt_ips | default([]) + patroni_agent_subject_alt_names | default([]) + patroni_server_subject_alt_ips_from_ansible_host | default([]) + patroni_server_subject_alt_ips_all_ipv4 | default([]) + patroni_agent_subject_alt_ips_from_ansible_host | default([]) + patroni_server_subject_alt_ips_force_append | default([]) + patroni_server_subject_alt_names_force_append | default([]) }}" owner: postgres group: postgres register: patroni_csr