Does anyone have experiences randomizing the order of redundant server names in the client configuration and won't change the order during next puppet agent runs?
For example, I have a bunch of ldap slave servers put in an array:
$_ldap_servers = ['ldap1' , 'ldap2', 'ldap3']
I want to randomize the order in the client config (ex, nslcd.conf or sssd.conf ) so they don't always hit the same ldap server.
ex:
ldap_search_base = dc=example, dc=com
ldap_uri = ldaps://ldap2 ldaps://ldap0 ldaps://ldap3
What I did so far is that in the ERB template, I put the following code:
````
ldap_uri = <%
server_list = @_ldap_servers.shuffle
server_list.size.times do
server = server_list[rand(server_list.size)] -%>ldaps://<%= server -%>/ <%
server_list.delete(server)
end %>
```
It was working well with Rack based puppetmaster 3.x, but after upgrading to puppetserver 2.7.x, it changes the order every time when agent runs.
Does anyone have any suggestions?
Thanks so much!
MK