consul-template loop overs services and service results

518 views
Skip to first unread message

Olve Hansen

unread,
Jan 11, 2015, 5:00:42 AM1/11/15
to consu...@googlegroups.com
I am trying to loop over all consul services to create a haproxy config, without declaring each service by itself.

See this gist to see what I am attempting 
(the two last files in the gist is for showing that my consul instance actually has instances to list as nodes)

This template works (as in no errors), but does not give the intended result as it doe not list each node for the service.

Any tips to make this work? I am struggling a bit with go and how templating works (it seems).

Regards, 
Olve

Seth Vargo

unread,
Jan 11, 2015, 8:36:14 AM1/11/15
to Olve Hansen, consu...@googlegroups.com
Hi Olve,

This is not currently possible. See https://github.com/hashicorp/consul-template/issues/64 for more information please. We hope to have this fixed soon.

Best,
Seth

--
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Olve Hansen

unread,
Jan 12, 2015, 11:15:59 AM1/12/15
to consu...@googlegroups.com, ol...@vimond.com
Thanks for the pointer.

A bit disappointing, this was the crux of my setup :-)
Can you say anything about the priorities of this issue?

Regards, 
Olve

Seth Vargo

unread,
Jan 12, 2015, 12:19:14 PM1/12/15
to Olve Hansen, consu...@googlegroups.com
Hi Olve,

I cannot speak the priority, but it's a rather difficult problem to solve (as discussed in the issue). I don't know when I'll have time to tackle it :).

Best,
Seth

Olve Hansen

unread,
Jan 12, 2015, 5:06:35 PM1/12/15
to consu...@googlegroups.com, ol...@vimond.com
Sure  Seth - no prob. Guess I will have to find a way to build the services part with ansible, generating a template from a template. Both with {{...}} as markup.... :-/
No go guy (yet) but it looked easy at first glances at the source code (function with string param, how hard could it be) - but I understand now that it is more too it than that.

Regards, 
Olve
Reply all
Reply to author
Forward
0 new messages