From 934cef544afd931981bb76476997f2af7fdba8a8 Mon Sep 17 00:00:00 2001 From: jeremy Date: Wed, 4 Feb 2026 10:00:18 -0600 Subject: [PATCH] Add Consul templates --- roles/consul/templates/consul.hcl.j2 | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 roles/consul/templates/consul.hcl.j2 diff --git a/roles/consul/templates/consul.hcl.j2 b/roles/consul/templates/consul.hcl.j2 new file mode 100644 index 0000000..0cf11df --- /dev/null +++ b/roles/consul/templates/consul.hcl.j2 @@ -0,0 +1,48 @@ +# {{ ansible_managed }} +# Consul Agent Configuration + +datacenter = "{{ consul_datacenter }}" +data_dir = "{{ consul_data_dir }}" +log_level = "{{ consul_log_level }}" + +# Network configuration +bind_addr = "{{ consul_bind_addr }}" +client_addr = "{{ consul_client_addr }}" + +# Cluster join configuration +{% if consul_retry_join | length > 0 %} +retry_join = {{ consul_retry_join | to_json }} +{% endif %} + +# Encryption +{% if consul_encrypt_key != "" %} +encrypt = "{{ consul_encrypt_key }}" +{% endif %} + +# DNS configuration +domain = "{{ consul_domain }}" + +ports { + http = {{ consul_ports.http }} + https = {{ consul_ports.https }} + grpc = {{ consul_ports.grpc }} + dns = {{ consul_ports.dns }} +} + +# UI +ui_config { + enabled = {{ consul_ui_enabled | lower }} +} + +# Performance tuning for small clusters +performance { + raft_multiplier = 1 +} + +# Enable local script checks +enable_local_script_checks = true + +# Service mesh (Connect) +connect { + enabled = true +}