Le mercredi 26 mai 2010 à 05:03 -0700, Gonçalo a écrit : Hello Gonçalo
> Hi there, im trying to set up puppet to manage a nginx server with > load balancing. To achieve this i need to add every machine ip to the > "upstream" conf of nginx. Doing this manually is easy, and all works > fine, the problem is that i would like to have every upstream machine > to "warn" the nginx to add that machine ip to the conf. This way i > would not need to change the conf manually everytime i add/remove a > machine. > To solve this problem i only found one solution (untested yet), that > would be have every upstream machine use Exported Resources to create > a file with its ip:port on a folder on the nginx server, and then have > a batch program creating the nginx conf, based on those files... > Is there any elegant way to do this? > I already posted this question on server fault (http://serverfault.com/ > questions/145244/load-balancing-with-puppet), and at that time i was > thinking of just write an include directive inside the upstream on the > conf, but that is not accepted by nginx, so i only have the option > above left..and the one someone can possibly say here :-) > Thanks I do this with templates with embedded ruby. This is not the best practice, it's pretty far away from it. Your solution with exported resources is almost the same, except the fact you're using file (when I'm using a database) The only problem I see is when you have multiple upstream : how will you know in which upstream you want a server to be ? Regarding the concat module I don't see how to use it for this because some "calculations" have to be made. To me the only "quick" solution is a template embedding ruby, and the only "clean" solution is a native type (longer to do/test/maintain) as David suggests. My 2c Nico.
signature.asc
Description: Ceci est une partie de message numériquement signée