---

- name: Check IPv6 support
  command: /usr/sbin/sysctl -n net.ipv6.conf.all.disable_ipv6
  register: ipv6_disabled
  changed_when: false

- name: Setting sysctl values
  include_role:
    name: sysctl
  vars:
    settings:
      - { name: "net.ipv6.ip_nonlocal_bind", value: 1 }
      - { name: "net.ipv4.ip_nonlocal_bind", value: 1 }
      - { name: "net.ipv4.tcp_retries2", value: "{{ haproxy_host_ipv4_tcp_retries2 }}" }
      - { name: "net.unix.max_dgram_qlen", value: 128 }
  when:
    - set_sysctl | bool

- name: Load and persist keepalived module
  import_role:
    name: module-load
  vars:
    modules:
      - {'name': ip_vs }
