Has anyone found a way to get peers working with server-template?
It seems that server-template just fills in ip addresses in the order it gets them from DNS, which means if the DNS server responds in a random order different peers will have the same server ids pointing to different servers. Even if DNS is in a consistent order, if the set of records changes, then if different haproxy peers restart at different times, you can end up in a similar situation.
I’ve opened a feature request at https://github.com/haproxy/haproxy/issues/814 to support this use-case better. But has anyone found a good workaround for this?
The only solution I’ve found is to dynamically generate haproxy config with server lines in a weel-defined order, and restarting/reloading haproxy whenever the DNS changes, which is less than ideal.