main.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. # It's important that we don't explicitly pull this image here. Otherwise we
  3. # could result in upgrading a preinstalled environment. We'll have to set
  4. # openshift_image_tag correctly for upgrades.
  5. - set_fact:
  6. is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
  7. # Does the host already have an image tag fact, used to determine if it's a new node
  8. # in non-upgrade scenarios:
  9. has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}"
  10. - debug: var=openshift_image_tag
  11. - debug: var=openshift_release
  12. - name: Set version when containerized
  13. command: >
  14. docker run --rm {{ openshift.common.cli_image }} version
  15. register: cli_image_version
  16. when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool)
  17. # Use the pre-existing image tag from system facts if present, and we're not upgrading.
  18. # Ignores explicit openshift_image_tag if it's in the inventory, as this isn't an upgrade.
  19. - set_fact:
  20. l_image_tag: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag }}"
  21. when: is_containerized | bool and not upgrading | bool and has_image_tag_fact | bool
  22. - set_fact:
  23. l_image_tag: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-') if openshift.common.deployment_type == 'origin' else
  24. cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0] }}"
  25. when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool)
  26. - set_fact:
  27. l_image_tag: "{{ openshift_image_tag }}"
  28. when: is_containerized | bool and openshift_image_tag is defined and (upgrading | bool or not has_image_tag_fact | bool)
  29. - name: Set post docker install facts
  30. openshift_facts:
  31. role: "{{ item.role }}"
  32. local_facts: "{{ item.local_facts }}"
  33. with_items:
  34. - role: docker
  35. local_facts:
  36. openshift_image_tag: "{{ l_image_tag | default(None) }}"
  37. openshift_version: "{{ l_image_tag.split('-')[0] | oo_image_tag_to_rpm_version if l_image_tag is defined else '' }}"
  38. when: is_containerized | bool