---
# This playbook waits for registry and router pods after both have been
# created.  It is intended to allow the tasks of deploying both to complete
# before polling to save time.
- name: Poll for hosted pod deployments
  hosts: oo_first_master
  tasks:
  # Need to set_fact variable for registry.
  - import_role:
      name: openshift_hosted
      tasks_from: set_fact_workaround.yml
  - import_role:
      name: openshift_hosted
      tasks_from: wait_for_pod.yml
    vars:
      l_openshift_hosted_wait_for_pod: "{{ openshift_hosted_router_wait }}"
      l_openshift_hosted_wfp_items: "{{ openshift_hosted_routers }}"
    when:
    - openshift_hosted_manage_router | default(True) | bool
    - openshift_hosted_router_registryurl is defined

  - import_role:
      name: openshift_hosted
      tasks_from: wait_for_pod.yml
    vars:
      l_openshift_hosted_wait_for_pod: "{{ openshift_hosted_registry_wait }}"
      l_openshift_hosted_wfp_items: "{{ r_openshift_hosted_registry_list }}"
    when:
    - openshift_hosted_manage_registry | default(True) | bool
    - openshift_hosted_registry_registryurl is defined
