global 
  user haproxy 
  group haproxy 
 
defaults KEYDB
  mode tcp 
  timeout connect 3s 
  timeout server 6s 
  timeout client 6s 
 
frontend ft_keydb 
  bind {{ keepalived_vip }}:{{ vip_port }} name redis 
  default_backend bk_keydb 
 
backend bk_keydb 
  option tcp-check 
  #tcp-check send *1\r\n$4\r\nping\r\n 
  #tcp-check expect string +PONG
  tcp-check send PING\r\n
  tcp-check expect string +PONG
  tcp-check send info\ replication\r\n
  tcp-check expect string role: active-replica
  tcp-check send QUIT\r\n
  tcp-check expect string +OK 
  {% for item in haproxy_backend_servers %}
  server {{ item }} {{ hostvars[item]['ansible_host'] }}:{{ redis_port }} check inter 100ms
  {% endfor %}
