verify_cluster.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. - fail:
  8. msg: >
  9. This upgrade is only supported for origin and openshift-enterprise
  10. deployment types
  11. when: deployment_type not in ['origin','openshift-enterprise']
  12. # Error out in situations where the user has older versions specified in their
  13. # inventory in any of the openshift_release, openshift_image_tag, and
  14. # openshift_pkg_version variables. These must be removed or updated to proceed
  15. # with upgrade.
  16. # TODO: Should we block if you're *over* the next major release version as well?
  17. - fail:
  18. msg: >
  19. openshift_pkg_version is {{ openshift_pkg_version }} which is not a
  20. valid version for a {{ openshift_upgrade_target }} upgrade
  21. when:
  22. - openshift_pkg_version is defined
  23. - openshift_pkg_version.split('-',1).1 is version_compare(openshift_upgrade_target ,'<')
  24. - fail:
  25. msg: >
  26. openshift_image_tag is {{ openshift_image_tag }} which is not a
  27. valid version for a {{ openshift_upgrade_target }} upgrade
  28. when:
  29. - openshift_image_tag is defined
  30. - openshift_image_tag.split('v',1).1 is version_compare(openshift_upgrade_target ,'<')
  31. - set_fact:
  32. openshift_release: "{{ openshift_release[1:] }}"
  33. when: openshift_release is defined and openshift_release[0] == 'v'
  34. - fail:
  35. msg: >
  36. openshift_release is {{ openshift_release }} which is not a
  37. valid release for a {{ openshift_upgrade_target }} upgrade
  38. when:
  39. - openshift_release is defined
  40. - not (openshift_release is version_compare(openshift_upgrade_target ,'='))
  41. - name: Verify master processes
  42. hosts: oo_masters_to_config
  43. roles:
  44. - lib_utils
  45. - openshift_facts
  46. tasks:
  47. - name: Read master storage backend setting
  48. yedit:
  49. state: list
  50. src: /etc/origin/master/master-config.yaml
  51. key: kubernetesMasterConfig.apiServerArguments.storage-backend
  52. register: _storage_backend
  53. - fail:
  54. msg: "Storage backend in /etc/origin/master/master-config.yaml must be set to 'etcd3' before the upgrade can continue"
  55. when:
  56. # assuming the master-config.yml is properly configured, i.e. the value is a list
  57. - _storage_backend.result | default([], true) | length == 0 or _storage_backend.result[0] != "etcd3"
  58. - debug:
  59. msg: "Storage backend is set to etcd3"
  60. - openshift_facts:
  61. role: master
  62. local_facts:
  63. ha: "{{ groups.oo_masters_to_config | length > 1 }}"
  64. - when: openshift_is_containerized | bool
  65. block:
  66. - set_fact:
  67. master_services:
  68. - "{{ openshift_service_type }}-master"
  69. # In case of the non-ha to ha upgrade.
  70. - name: Check if the {{ openshift_service_type }}-master-api.service exists
  71. command: >
  72. systemctl list-units {{ openshift_service_type }}-master-api.service --no-legend
  73. register: master_api_service_status
  74. - set_fact:
  75. master_services:
  76. - "{{ openshift_service_type }}-master-api"
  77. - "{{ openshift_service_type }}-master-controllers"
  78. when:
  79. - master_api_service_status.stdout_lines | length > 0
  80. - (openshift_service_type + '-master-api.service') in master_api_service_status.stdout_lines[0]
  81. - name: Ensure Master is running
  82. service:
  83. name: "{{ item }}"
  84. state: started
  85. enabled: yes
  86. with_items: "{{ master_services }}"