---
# Label nodes and wait for apiserver and controller to be running (at least one)
- name: Label {{ openshift.node.nodename }} for APIServer and controller deployment
  oc_label:
    name: "{{ openshift.node.nodename }}"
    kind: node
    state: add
    labels: "{{ openshift_service_catalog_nodeselector | default ({'openshift-infra': 'apiserver'}) | lib_utils_oo_dict_to_list_of_dict }}"

# wait to see that the apiserver is available
- name: wait for api server to be ready
  uri:
    url: https://apiserver.kube-service-catalog.svc/healthz
    validate_certs: no
    return_content: yes
  environment:
    no_proxy: '*'
  register: api_health
  until: "'ok' in api_health.content"
  retries: 60
  delay: 10
  changed_when: false
