Newbie to python here. I'm in need of adding back end and front ends servers to the haproxy.cfg file and do a graceful reload via a python script. Could some of you point me in the right direction. If you include comments in the code it will immensely help me to understand faster.
Below is a sample block that I want to send in to the cfg, possibly based on raw_input([arg])
frontend fe:some_fe:bind:yyyy
mode tcp
bind x.x.x.x:yyyy name some_name
use_backend be:some_be:x.x.x.x:yyyy
backend be:some_be:x.x.x.x:yyyy
mode http
balance roundrobin
server x.x.x.x:yyyy check port yyyy
server x.x.x.x:yyyy check port yyyy
Some notes- x.x.x.x signifies an ip and yyyy a port.
Please help! Many thanks in advance.