On Wednesday, October 10, 2012 11:10:32 AM UTC-5, trevman wrote:
I'm looking for a way to balance out services when insuring the content of configuration files.
Example is how to do this with /etc/yp.conf:
##
domain example.com server 192.168.1.2
domain example.com server 192.168.1.3
domain example.com server 192.168.1.4
##
I'd like to change the order of the entries in a random or rotating fashion so that multiple machines would get a different order so that we can scale the services without having to invest in a load balancer.
Obviously, we wouldn't want the contents to continually change on every machine, so the tests would need to be appropriate.
Any ideas?
There are lots of ways you could do this, but the the ready-built fqdn_rotate() function in Puppetlabs's add-in "stdlib" module (
https://github.com/puppetlabs/puppetlabs-stdlib) would probably serve as a good foundation. Put the NIS server IPs in an array, shuffle it with fqdn_rand(), and read the results out into your yp.conf template. Each node will have a consistent order as long as its FQDN does not change.
John