verify_upgrade_targets.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. - name: Fail when OpenShift is not installed
  3. fail:
  4. msg: Verify OpenShift is already installed
  5. when: openshift.common.version is not defined
  6. - name: Update oreg_auth docker login credentials if necessary
  7. include_role:
  8. name: container_runtime
  9. tasks_from: registry_auth.yml
  10. when: oreg_auth_user is defined
  11. - name: Verify containers are available for upgrade
  12. command: >
  13. docker pull {{ openshift_cli_image }}:{{ openshift_image_tag }}
  14. register: pull_result
  15. changed_when: "'Downloaded newer image' in pull_result.stdout"
  16. when: openshift.common.is_containerized | bool
  17. - when: not openshift.common.is_containerized | bool
  18. block:
  19. - name: Check latest available OpenShift RPM version
  20. repoquery:
  21. name: "{{ openshift.common.service_type }}"
  22. ignore_excluders: true
  23. register: repoquery_out
  24. - name: Fail when unable to determine available OpenShift RPM version
  25. fail:
  26. msg: "Unable to determine available OpenShift RPM version"
  27. when:
  28. - not repoquery_out.results.package_found
  29. - name: Set fact avail_openshift_version
  30. set_fact:
  31. avail_openshift_version: "{{ repoquery_out.results.versions.available_versions_full.0 }}"
  32. - name: Set openshift_pkg_version when not specified
  33. set_fact:
  34. openshift_pkg_version: "-{{ repoquery_out.results.versions.available_versions_full.0 }}"
  35. when: openshift_pkg_version | default('') == ''
  36. - name: Verify OpenShift RPMs are available for upgrade
  37. fail:
  38. msg: "OpenShift {{ avail_openshift_version }} is available, but {{ openshift_upgrade_target }} or greater is required"
  39. when:
  40. - (openshift_pkg_version | default('-0.0', True)).split('-')[1] | version_compare(openshift_release, '<')
  41. - name: Fail when openshift version does not meet minium requirement for Origin upgrade
  42. fail:
  43. msg: "This upgrade playbook must be run against OpenShift {{ openshift_upgrade_min }} or later"
  44. when:
  45. - deployment_type == 'origin'
  46. - openshift.common.version | version_compare(openshift_upgrade_min,'<')