mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-04-26 23:23:22 +02:00
19 lines
1.1 KiB
Django/Jinja
19 lines
1.1 KiB
Django/Jinja
{% if consul_conf.server %}
|
|
[[ with pkiCert "{{ consul_vault_secrets.pki.path }}/issue/{{ consul_vault_secrets.pki.role }}" "common_name=server-{{ ansible_fqdn | regex_replace('\\.', '-') }}.{{ consul_conf.datacenter | default('dc1') }}.{{ consul_conf.domain | default('consul') }}" "alt_names=localhost,consul.service.{{ consul_conf.domain | default('consul') }},server.{{ consul_conf.datacenter | default('dc1') }}.{{ consul_conf.domain | default('consul') }}" ]]
|
|
[[ .CA ]]
|
|
[[ .Cert ]]
|
|
[[ .Key ]]
|
|
[[ .CA | writeToFile "{{ consul_conf.tls.defaults.ca_file }}" "root" "root" "0644" ]]
|
|
[[ .Cert | writeToFile "{{ consul_conf.tls.defaults.cert_file }}" "root" "root" "0644" ]]
|
|
[[ .Key | writeToFile "{{ consul_conf.tls.defaults.key_file }}" "root" "{{ consul_user }}" "0640" ]]
|
|
[[ end ]]
|
|
[[ with secret "{{ consul_vault_secrets.pki.path }}/cert/ca" ]]
|
|
[[ .Data.certificate | writeToFile "{{ consul_conf.tls.defaults.cert_file }}" "root" "root" "0644" "append,newline" ]]
|
|
[[ end ]]
|
|
{% else %}
|
|
[[ with secret "{{ consul_vault_secrets.pki.path }}/cert/ca" ]]
|
|
[[ .Data.certificate | writeToFile "{{ consul_conf.tls.defaults.ca_file }}" "root" "root" "0644" ]]
|
|
[[ end ]]
|
|
{% endif %}
|
|
|