def oo_haproxy_backend_masters(hosts, port):
 servers = []
 for (idx, host_info) in enumerate(hosts):
  server = dict(name=('master%s' % idx))
  server_ip = host_info['openshift']['common']['ip']
  server['address'] = ('%s:%s' % (server_ip, port))
  server['opts'] = 'check'
  servers.append(server)
 return servers

def oo_haproxy_backend_masters ( hosts , port ) : servers = [ ] for ( idx , host_info ) in enumerate ( hosts ) : server = dict ( name = ( 'master%s' % idx ) ) server_ip = host_info [ 'openshift' ] [ 'common' ] [ 'ip' ] server [ 'address' ] = ( '%s:%s' % ( server_ip , port ) ) server [ 'opts' ] = 'check' servers . append ( server ) return servers
this takes an array of dicts and returns an array of dicts to be used as a backend for the haproxy role .