This was a solution building off of @stephenmurdoch's answer which involved the use of multiple -f <conf file>
arguments to the haproxy
executable.
Using the stock CentOS 6.x RPM's included /etc/init.d/haproxy
script you can amend it like so:
start() {
$exec -c -q -f $cfgfile $OPTIONS
if [ $? -ne 0 ]; then
echo "Errors in configuration file, check with $prog check."
return 1
fi
echo -n $"Starting $prog: "
# start it up here, usually something like "daemon $exec"
#daemon $exec -D -f $cfgfile -f /etc/haproxy/haproxy_ds.cfg -f /etc/haproxy/haproxy_es.cfg -f /etc/haproxy/haproxy_stats.cfg -p $pidfile $OPTIONS
daemon $exec -D -f $cfgfile $(for i in /etc/haproxy/haproxy_*.cfg;do echo -n "-f $i ";done) -p $pidfile $OPTIONS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
With the above in place you can then create files such as haproxy_<X>.cfg
and haproxy_<Y>.cfg
using whatever names you want. The above for loop will include these files in an augmented daemon haproxy ...
line if these files are present, otherwise the stock haproxy.cfg
file will be used solely.
Within the haproxy_<...>.cfg
files you need to make sure that your global and defaults are defined in the "toplevel" haproxy.cfg
file. The rest of the files simply need to have frontend/backends and nothing more.