verify_cluster.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ---
  2. # Verify a few items before we proceed with upgrade process.
  3. - name: Verify upgrade can proceed on first master
  4. hosts: oo_first_master
  5. gather_facts: no
  6. tasks:
  7. # Error out in situations where the user has older versions specified in their
  8. # inventory in any of the openshift_release, openshift_image_tag, and
  9. # openshift_pkg_version variables. These must be removed or updated to proceed
  10. # with upgrade.
  11. # TODO: Should we block if you're *over* the next major release version as well?
  12. - fail:
  13. msg: >
  14. openshift_pkg_version is {{ openshift_pkg_version }} which is not a
  15. valid version for a {{ openshift_upgrade_target }} upgrade
  16. when:
  17. - openshift_pkg_version is defined
  18. - openshift_pkg_version != ""
  19. - openshift_pkg_version.split('-',1).1 is version(openshift_upgrade_target ,'<')
  20. - fail:
  21. msg: >
  22. openshift_image_tag is {{ openshift_image_tag }} which is not a
  23. valid version for a {{ openshift_upgrade_target }} upgrade
  24. when:
  25. - openshift_image_tag is defined
  26. - openshift_image_tag != ""
  27. - openshift_image_tag.split('v',1).1 is version(openshift_upgrade_target ,'<')
  28. - set_fact:
  29. openshift_release: "{{ openshift_release[1:] }}"
  30. when: openshift_release is defined and openshift_release[0] == 'v'
  31. - fail:
  32. msg: >
  33. openshift_release is {{ openshift_release }} which is not a
  34. valid release for a {{ openshift_upgrade_target }} upgrade
  35. when:
  36. - openshift_release is defined
  37. - not (openshift_release is version(openshift_upgrade_target ,'='))
  38. # Ensure glusterfs clusters are healthy before starting an upgrade.
  39. - import_role:
  40. name: openshift_storage_glusterfs
  41. tasks_from: check_cluster_health.yml
  42. when: >
  43. ('glusterfs' in groups and groups['glusterfs'] | length > 0)
  44. or ('glusterfs_registry' in groups and groups['glusterfs_registry'] | length > 0)
  45. - name: Verify master processes
  46. hosts: oo_masters_to_config
  47. roles:
  48. - lib_utils
  49. - openshift_facts
  50. tasks:
  51. - name: Read master storage backend setting
  52. yedit:
  53. state: list
  54. src: /etc/origin/master/master-config.yaml
  55. key: kubernetesMasterConfig.apiServerArguments.storage-backend
  56. register: _storage_backend
  57. - fail:
  58. msg: "The cluster must be migrated to etcd v3 prior to upgrading to 3.7. Please see https://docs.openshift.com/container-platform/3.7/install_config/upgrading/migrating_etcd.html"
  59. when:
  60. # assuming the master-config.yml is properly configured, i.e. the value is a list
  61. - _storage_backend.result | default([], true) | length == 0 or _storage_backend.result[0] != "etcd3"
  62. - debug:
  63. msg: "Storage backend is set to etcd3"
  64. - openshift_facts:
  65. role: master
  66. local_facts:
  67. ha: "{{ groups.oo_masters_to_config | length > 1 }}"