---
- name: Setting sysctl values
  vars:
    should_set: "{{ item.value != 'KOLLA_UNSET' }}"
  sysctl:
    name: "{{ item.name }}"
    state: "{{ should_set | ternary('present', 'absent') }}"
    value: "{{ should_set | ternary(item.value, omit) }}"
    sysctl_set: "{{ should_set }}"
    sysctl_file: "{{ kolla_sysctl_conf_path }}"
  become: true
  with_items:
    - { name: "net.ipv4.ip_nonlocal_bind", value: 1 }
    - { name: "net.ipv6.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
    - item.value != 'KOLLA_SKIP'

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