ansible-roles/roles/nomad/templates/consul-template.hcl.j2

44 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-09-02 18:00:22 +02:00
vault {
2022-09-06 18:00:22 +02:00
address = "{{ nomad_vault_secrets.vault_address }}"
token = "{{ nomad_vault_secrets.vault_token }}"
2022-09-02 18:00:22 +02:00
unwrap_token = false
}
2022-09-13 17:00:08 +02:00
# Sleep 25 sec before sending nomad service a reload to prevent it from crashing as
2022-09-06 18:00:22 +02:00
# Nomad doesn't support getting a reload while it's still initializing
{% if nomad_vault_secrets.pki.enabled %}
2022-09-02 18:00:22 +02:00
template {
2022-09-13 17:00:08 +02:00
source = "{{ nomad_root_dir }}/consul-template/agent_bundle.pem.tpl"
2022-09-02 18:00:22 +02:00
left_delimiter = "[["
right_delimiter = "]]"
2022-09-13 17:00:08 +02:00
destination = "{{ nomad_root_dir }}/tls/agent_bundle.pem"
2022-09-02 18:00:22 +02:00
perms = 0640
exec {
2022-09-13 17:00:08 +02:00
command = "sh -c 'sleep 25 && systemctl reload nomad || true'"
2022-09-02 18:00:22 +02:00
}
}
2022-09-04 01:00:25 +02:00
{% if nomad_conf.server.enabled %}
2022-09-02 18:00:22 +02:00
template {
2022-09-13 17:00:08 +02:00
source = "{{ nomad_root_dir }}/consul-template/cli_bundle.pem.tpl"
destination = "{{ nomad_root_dir }}/tls/cli_bundle.pem"
2022-09-02 18:00:22 +02:00
left_delimiter = "[["
right_delimiter = "]]"
perms = 0640
}
2022-09-04 01:00:25 +02:00
{% endif %}
2022-09-04 18:00:17 +02:00
2022-09-08 18:00:11 +02:00
{% if nomad_vault_secrets.consul_pki.enabled and nomad_conf.consul.ssl %}
2022-09-04 18:00:17 +02:00
template {
2022-09-13 17:00:08 +02:00
source = "{{ nomad_root_dir }}/consul-template/consul_bundle.pem.tpl"
2022-09-20 13:00:08 +02:00
destination = "{{ nomad_root_dir }}/tls/consul_bundle.pem"
2022-09-04 18:00:17 +02:00
left_delimiter = "[["
right_delimiter = "]]"
perms = 0640
2022-09-06 18:00:22 +02:00
exec {
2022-09-13 17:00:08 +02:00
command = "sh -c 'sleep 25 && systemctl reload nomad || true'"
2022-09-04 18:00:17 +02:00
}
}
{% endif %}
2022-09-13 17:00:08 +02:00
{% endif %}