verify_cluster.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.split('-',1).1 is version_compare(openshift_upgrade_target ,'<')
  19. - fail:
  20. msg: >
  21. openshift_image_tag is {{ openshift_image_tag }} which is not a
  22. valid version for a {{ openshift_upgrade_target }} upgrade
  23. when:
  24. - openshift_image_tag is defined
  25. - openshift_image_tag.split('v',1).1 is version_compare(openshift_upgrade_target ,'<')
  26. - set_fact:
  27. openshift_release: "{{ openshift_release[1:] }}"
  28. when: openshift_release is defined and openshift_release[0] == 'v'
  29. - fail:
  30. msg: >
  31. openshift_release is {{ openshift_release }} which is not a
  32. valid release for a {{ openshift_upgrade_target }} upgrade
  33. when:
  34. - openshift_release is defined
  35. - not (openshift_release is version_compare(openshift_upgrade_target ,'='))
  36. - name: Verify master processes
  37. hosts: oo_masters_to_config
  38. roles:
  39. - lib_utils
  40. - openshift_facts
  41. tasks:
  42. - name: Read master storage backend setting
  43. yedit:
  44. state: list
  45. src: /etc/origin/master/master-config.yaml
  46. key: kubernetesMasterConfig.apiServerArguments.storage-backend
  47. register: _storage_backend
  48. - fail:
  49. msg: "Storage backend in /etc/origin/master/master-config.yaml must be set to 'etcd3' before the upgrade can continue"
  50. when:
  51. # assuming the master-config.yml is properly configured, i.e. the value is a list
  52. - _storage_backend.result | default([], true) | length == 0 or _storage_backend.result[0] != "etcd3"
  53. - debug:
  54. msg: "Storage backend is set to etcd3"
  55. - openshift_facts:
  56. role: master
  57. local_facts:
  58. ha: "{{ groups.oo_masters_to_config | length > 1 }}"
  59. - when: openshift_is_containerized | bool
  60. block:
  61. - set_fact:
  62. master_services:
  63. - "{{ openshift_service_type }}-master"
  64. # In case of the non-ha to ha upgrade.
  65. - name: Check if the {{ openshift_service_type }}-master-api.service exists
  66. command: >
  67. systemctl list-units {{ openshift_service_type }}-master-api.service --no-legend
  68. register: master_api_service_status
  69. - set_fact:
  70. master_services:
  71. - "{{ openshift_service_type }}-master-api"
  72. - "{{ openshift_service_type }}-master-controllers"
  73. when:
  74. - master_api_service_status.stdout_lines | length > 0
  75. - (openshift_service_type + '-master-api.service') in master_api_service_status.stdout_lines[0]
  76. - name: Ensure Master is running
  77. service:
  78. name: "{{ item }}"
  79. state: started
  80. enabled: yes
  81. with_items: "{{ master_services }}"