[[ with pkiCert "{{ nomad_vault_secrets.consul_pki.path }}/issue/{{ nomad_vault_secrets.consul_pki.role }}" "common_name={{ ansible_fqdn | regex_replace('\\.', '-') }}.{{ (consul_conf is defined and consul_conf.domain is defined) | ternary(consul_conf.domain, 'consul') }}"{% if nomad_vault_secrets.consul_pki.ttl is defined %} "ttl={{ nomad_vault_secrets.consul_pki.ttl }}"{% endif %} ]] [[ .CA ]] [[ .Cert ]] [[ .Key ]] [[ .CA | writeToFile "{{ nomad_conf.consul.ca_file }}" "root" "root" "0644" ]] [[ .Cert | writeToFile "{{ nomad_conf.consul.cert_file }}" "root" "root" "0644" ]] [[ .Key | writeToFile "{{ nomad_conf.consul.key_file }}" "root" "{{ nomad_user }}" "0640" ]] [[ end ]] [[ with secret "{{ nomad_vault_secrets.consul_pki.root_path }}/cert/ca" ]] [[ .Data.certificate | writeToFile "{{ nomad_conf.consul.ca_file }}" "root" "root" "0644" "append,newline" ]] [[ end ]]