verify_upgrade_targets.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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: Verify containers are available for upgrade
  7. command: >
  8. docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }}
  9. register: pull_result
  10. changed_when: "'Downloaded newer image' in pull_result.stdout"
  11. when: openshift.common.is_containerized | bool
  12. - when: not openshift.common.is_containerized | bool
  13. block:
  14. - name: Check latest available OpenShift RPM version
  15. repoquery:
  16. name: "{{ openshift.common.service_type }}"
  17. ignore_excluders: true
  18. register: repoquery_out
  19. - name: Fail when unable to determine available OpenShift RPM version
  20. fail:
  21. msg: "Unable to determine available OpenShift RPM version"
  22. when:
  23. - not repoquery_out.results.package_found
  24. - name: Set fact avail_openshift_version
  25. set_fact:
  26. avail_openshift_version: "{{ repoquery_out.results.versions.available_versions.0 }}"
  27. - name: Verify OpenShift RPMs are available for upgrade
  28. fail:
  29. msg: "OpenShift {{ avail_openshift_version }} is available, but {{ openshift_upgrade_target }} or greater is required"
  30. when:
  31. - avail_openshift_version | default('0.0', True) | version_compare(openshift_release, '<')
  32. - name: Fail when openshift version does not meet minium requirement for Origin upgrade
  33. fail:
  34. msg: "This upgrade playbook must be run against OpenShift {{ openshift_upgrade_min }} or later"
  35. when:
  36. - deployment_type == 'origin'
  37. - openshift.common.version | version_compare(openshift_upgrade_min,'<')