diff --git a/roles/nomad/templates/nomad.hcl.j2 b/roles/nomad/templates/nomad.hcl.j2 new file mode 100644 index 0000000..051781f --- /dev/null +++ b/roles/nomad/templates/nomad.hcl.j2 @@ -0,0 +1,45 @@ +# {{ ansible_managed }} +# Nomad Agent Configuration + +datacenter = "{{ nomad_datacenter }}" +region = "{{ nomad_region }}" +data_dir = "{{ nomad_data_dir }}" +log_level = "{{ nomad_log_level }}" + +bind_addr = "{{ nomad_bind_addr }}" + +# Advertise addresses +advertise { + http = "{{ ansible_default_ipv4.address }}:4646" + rpc = "{{ ansible_default_ipv4.address }}:4647" + serf = "{{ ansible_default_ipv4.address }}:4648" +} + +# Consul integration +consul { + address = "{{ nomad_consul_address }}" + auto_advertise = {{ nomad_consul_auto_advertise | lower }} + server_auto_join = {{ nomad_consul_server_auto_join | lower }} + client_auto_join = {{ nomad_consul_client_auto_join | lower }} + + # Service registration + server_service_name = "nomad" + client_service_name = "nomad-client" +} + +{% if nomad_vault_enabled %} +# Vault integration +vault { + enabled = true + address = "{{ nomad_vault_address }}" +} +{% endif %} + +# Telemetry (for Prometheus) +telemetry { + collection_interval = "10s" + disable_hostname = true + prometheus_metrics = true + publish_allocation_metrics = true + publish_node_metrics = true +}