verify_cluster.yml 3.4 KB

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