---
- name: Load Balancer Install Checkpoint Start
  hosts: all
  gather_facts: false
  tasks:
  - name: Set load balancer install 'In Progress'
    run_once: true
    set_stats:
      data:
        installer_phase_loadbalancer:
          status: "In Progress"
          start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"

- name: Configure load balancers
  hosts: oo_lb_to_config
  vars:
    openshift_loadbalancer_frontends: "{{ (openshift_master_api_port | default(8443)
                                           | lib_utils_oo_loadbalancer_frontends(hostvars | lib_utils_oo_select_keys(groups['oo_masters']),
                                                                                 openshift_use_nuage | default(false),
                                                                                 nuage_mon_rest_server_port | default(none)))
                                           + openshift_loadbalancer_additional_frontends | default([]) }}"
    openshift_loadbalancer_backends: "{{ (openshift_master_api_port | default(8443)
                                          | lib_utils_oo_loadbalancer_backends(hostvars | lib_utils_oo_select_keys(groups['oo_masters']),
                                                                               openshift_use_nuage | default(false),
                                                                               nuage_mon_rest_server_port | default(none)))
                                          + openshift_loadbalancer_additional_backends | default([]) }}"
    openshift_image_tag: "{{ hostvars[groups.oo_masters_to_config.0].openshift_image_tag }}"
  roles:
  - role: openshift_loadbalancer
  - role: tuned

- name: Load Balancer Install Checkpoint End
  hosts: all
  gather_facts: false
  tasks:
  - name: Set load balancer install 'Complete'
    run_once: true
    set_stats:
      data:
        installer_phase_loadbalancer:
          status: "Complete"
          end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
