consul-template icon indicating copy to clipboard operation
consul-template copied to clipboard

Add a way to template nomad nodes (similar to consul nodes).

Open blmhemu opened this issue 2 years ago • 3 comments

Feature Request

Add a way to enumerate over nomad nodes (and fetch the node data like ip, etc) similar to how we do for consul - https://github.com/hashicorp/consul-template/blob/main/docs/templating-language.md#nodes

This will enhance nomad service discovery story.

Use case

If we know which nodes nomad runs on can open up possibilities to connect to outside applications with known ports.

blmhemu avatar Dec 18 '23 10:12 blmhemu

You can access any data from the Consul service catalog in consul-template through the service function. Nomad server endpoints are registered under nomad service and clients can be found under nomad-client. This means you can do things like this with consul-template:

{{ range service "nomad-client" }} {{ .Address }}:{{ .Port }} {{ end }}

Would this work for your use case?

thevilledev avatar Mar 22 '24 18:03 thevilledev

The above solution needs consul and consul-nomad integration - But what I proposed should work for standalone nomad.

blmhemu avatar Mar 23 '24 04:03 blmhemu

Thanks, makes sense. Created a branch on my fork to work on it.

thevilledev avatar Mar 24 '24 18:03 thevilledev