---
# NOTE: requires openshift_facts be run
- name: Determine openshift_version to configure on first master
  hosts: oo_first_master
  roles:
  # Using the CLI role here to install the CLI tool/wrapper, and set the
  # openshift.common.version fact which other hosts can then reference.
  - openshift_cli
  pre_tasks:
  - debug: var=openshift.common.version
  - debug: var=openshift_version
  post_tasks:
  - debug: var=openshift.common.version
  - debug: var=openshift_version

# NOTE: We set this even on etcd hosts as they may also later run as masters,
# and we don't want to install wrong version of docker and have to downgrade
# later.
- name: Set openshift_version for all hosts
  hosts: oo_all_hosts
  tasks:
  - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version
  - debug: var=openshift.common.version
  - debug: var=openshift_version
    # TODO: Should we use the first master's "openshift_version" var instead of a fact? Could go to just openshift_docker role above, and skip CLI config this early.
  - set_fact:
      openshift_version: "{{ openshift.common.version if openshift.common.version is defined else hostvars[groups.oo_first_master.0].openshift.common.version.split('-')[0] }}"
    when: inventory_hostname != groups.oo_first_master.0
  - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version
  - debug: var=openshift.common.version
  - debug: var=openshift_version


---
# NOTE: requires openshift_facts be run
- name: Determine openshift_version to configure on first master
  hosts: oo_first_master
  roles:
  # Using the CLI role here to install the CLI tool/wrapper, and set the
  # openshift.common.version fact which other hosts can then reference.
  - openshift_version
  pre_tasks:
  - debug: var=openshift.common.version
  - debug: var=openshift_version
  post_tasks:
  - debug: var=openshift.common.version
  - debug: var=openshift_version

# NOTE: We set this even on etcd hosts as they may also later run as masters,
# and we don't want to install wrong version of docker and have to downgrade
# later.
- name: Set openshift_version for all hosts
  hosts: oo_all_hosts
  tasks:
  - debug: var=hostvars[groups.oo_first_master.0].openshift_version
  - debug: var=openshift.common.version
  - debug: var=openshift_version
  - set_fact:
      openshift_version: "{{ openshift.common.version if openshift.common.version is defined else hostvars[groups.oo_first_master.0].openshift_version }}"
    when: inventory_hostname != groups.oo_first_master.0
  - debug: var=hostvars[groups.oo_first_master.0].openshift_version
  - debug: var=openshift.common.version
  - debug: var=openshift_version


Stop requiring/using first master version fact and use openshift_version var instead.
Stop requiring/using first master version fact and use openshift_version var instead.
