upgrade_control_plane.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ---
  2. #
  3. # Control Plane Upgrade Playbook
  4. #
  5. # Upgrades masters and Docker (only on standalone etcd hosts)
  6. #
  7. # This upgrade does not include:
  8. # - node service running on masters
  9. # - docker running on masters
  10. # - node service running on dedicated nodes
  11. #
  12. # You can run the upgrade_nodes.yml playbook after this to upgrade these components separately.
  13. #
  14. - import_playbook: ../init.yml
  15. vars:
  16. l_upgrade_no_switch_firewall_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  17. l_init_fact_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  18. l_base_packages_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  19. - name: Configure the initial upgrade target for the common upgrade tasks
  20. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  21. tasks:
  22. - set_fact:
  23. # We use 3.9 here so when we run openshift_version we can get
  24. # correct values for 3.9, 3.8 we will hard-code the values in
  25. # ../pre/version_override.yml, if necessary.
  26. openshift_upgrade_target: '3.9'
  27. openshift_upgrade_min: '3.7'
  28. ## Check to see if we need to double upgrade (3.7 -> 3.8 -> 3.9)
  29. - name: Configure variables for double upgrade
  30. hosts: oo_masters_to_config:oo_etcd_to_config
  31. tasks:
  32. - set_fact:
  33. l_double_upgrade_cp: True
  34. l_version_override_hosts: "oo_masters_to_config:oo_etcd_to_config"
  35. l_double_upgrade_first_version: "3.8"
  36. l_double_upgrade_first_release: "3.8"
  37. when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
  38. - import_playbook: ../pre/config.yml
  39. # These vars a meant to exclude oo_nodes from plays that would otherwise include
  40. # them by default.
  41. vars:
  42. l_version_override_hosts: "oo_masters_to_config:oo_etcd_to_config"
  43. l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
  44. l_openshift_version_check_hosts: "oo_masters_to_config:!oo_first_master"
  45. l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  46. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  47. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  48. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  49. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  50. l_upgrade_excluder_hosts: "oo_masters_to_config"
  51. openshift_protect_installed_version: False
  52. when: l_double_upgrade_cp | default(False)
  53. - name: Flag pre-upgrade checks complete for hosts without errors 3.8
  54. hosts: oo_masters_to_config:oo_etcd_to_config
  55. tasks:
  56. - set_fact:
  57. pre_upgrade_complete: True
  58. when: l_double_upgrade_cp | default(False)
  59. # Pre-upgrade completed
  60. - name: Intermediate 3.8 Upgrade
  61. import_playbook: ../upgrade_control_plane.yml
  62. when: l_double_upgrade_cp | default(False)
  63. - name: Restore 3.9 version variables
  64. hosts: oo_masters_to_config:oo_etcd_to_config
  65. tasks:
  66. - set_fact:
  67. # all:!all == 0 hosts
  68. l_version_override_hosts: "all:!all"
  69. openshift_version: "{{ l_double_upgrade_saved_version }}"
  70. openshift_release: "{{ l_double_upgrade_saved_release }}"
  71. openshift_image_tag: "{{ l_double_upgrade_saved_tag }}"
  72. openshift_pkg_version: "{{ l_double_upgrade_saved_pkgv }}"
  73. when: l_double_upgrade_cp | default(False)
  74. ## 3.8 upgrade complete we should now be able to upgrade to 3.9
  75. - name: Clear some values now that we're done with double upgrades.
  76. hosts: oo_masters_to_config:oo_etcd_to_config
  77. tasks:
  78. - set_fact:
  79. l_double_upgrade_cp: False
  80. l_double_upgrade_cp_reset_version: False
  81. # We should be on 3.8 at this point, need to set upgrade_target to 3.9
  82. - name: Configure the upgrade target for second upgrade
  83. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  84. tasks:
  85. - set_fact:
  86. openshift_upgrade_target: '3.9'
  87. openshift_upgrade_min: '3.8'
  88. - import_playbook: ../pre/config.yml
  89. # These vars a meant to exclude oo_nodes from plays that would otherwise include
  90. # them by default.
  91. vars:
  92. l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
  93. l_openshift_version_check_hosts: "oo_masters_to_config:!oo_first_master"
  94. l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  95. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  96. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  97. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  98. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  99. l_upgrade_excluder_hosts: "oo_masters_to_config"
  100. openshift_protect_installed_version: False
  101. - name: Flag pre-upgrade checks complete for hosts without errors
  102. hosts: oo_masters_to_config:oo_etcd_to_config
  103. tasks:
  104. - set_fact:
  105. pre_upgrade_complete: True
  106. - import_playbook: ../upgrade_control_plane.yml
  107. # All controllers must be stopped at the same time then restarted
  108. - name: Cycle all controller services to force new leader election mode
  109. hosts: oo_masters_to_config
  110. gather_facts: no
  111. roles:
  112. - role: openshift_facts
  113. tasks:
  114. - name: Restart master controllers to force new leader election mode
  115. service:
  116. name: "{{ openshift_service_type }}-master-controllers"
  117. state: restarted
  118. when: openshift.common.rolling_restart_mode == 'services'
  119. - name: Re-enable master controllers to force new leader election mode
  120. service:
  121. name: "{{ openshift_service_type }}-master-controllers"
  122. enabled: true
  123. when: openshift.common.rolling_restart_mode == 'system'
  124. - import_playbook: ../post_control_plane.yml
  125. - hosts: oo_masters
  126. tasks:
  127. - import_role:
  128. name: openshift_web_console
  129. tasks_from: remove_old_asset_config
  130. # This is for a migration for a dc/docker-registry env var
  131. # https://bugzilla.redhat.com/show_bug.cgi?id=1540467
  132. # OPENSHIFT_DEFAULT_REGISTRY to REGISTRY_OPENSHIFT_SERVER_ADDR
  133. - hosts: oo_first_master
  134. tasks:
  135. - import_role:
  136. name: openshift_hosted
  137. tasks_from: migrate_default_registry_var.yml