upgrade_control_plane.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  45. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  46. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  47. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  48. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  49. l_upgrade_excluder_hosts: "oo_masters_to_config"
  50. openshift_protect_installed_version: False
  51. when: l_double_upgrade_cp | default(False)
  52. - name: Flag pre-upgrade checks complete for hosts without errors 3.8
  53. hosts: oo_masters_to_config:oo_etcd_to_config
  54. tasks:
  55. - set_fact:
  56. pre_upgrade_complete: True
  57. when: l_double_upgrade_cp | default(False)
  58. # Pre-upgrade completed
  59. - name: Intermediate 3.8 Upgrade
  60. import_playbook: ../upgrade_control_plane.yml
  61. when: l_double_upgrade_cp | default(False)
  62. - name: Restore 3.9 version variables
  63. hosts: oo_masters_to_config:oo_etcd_to_config
  64. tasks:
  65. - set_fact:
  66. # all:!all == 0 hosts
  67. l_version_override_hosts: "all:!all"
  68. openshift_version: "{{ l_double_upgrade_saved_version }}"
  69. openshift_release: "{{ l_double_upgrade_saved_release }}"
  70. openshift_image_tag: "{{ l_double_upgrade_saved_tag }}"
  71. openshift_pkg_version: "{{ l_double_upgrade_saved_pkgv }}"
  72. when: l_double_upgrade_cp | default(False)
  73. ## 3.8 upgrade complete we should now be able to upgrade to 3.9
  74. - name: Clear some values now that we're done with double upgrades.
  75. hosts: oo_masters_to_config:oo_etcd_to_config
  76. tasks:
  77. - set_fact:
  78. l_double_upgrade_cp: False
  79. l_double_upgrade_cp_reset_version: False
  80. # We should be on 3.8 at this point, need to set upgrade_target to 3.9
  81. - name: Configure the upgrade target for second upgrade
  82. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  83. tasks:
  84. - set_fact:
  85. openshift_upgrade_target: '3.9'
  86. openshift_upgrade_min: '3.8'
  87. - import_playbook: ../pre/config.yml
  88. # These vars a meant to exclude oo_nodes from plays that would otherwise include
  89. # them by default.
  90. vars:
  91. l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
  92. l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  93. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  94. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  95. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  96. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  97. l_upgrade_excluder_hosts: "oo_masters_to_config"
  98. openshift_protect_installed_version: False
  99. - name: Flag pre-upgrade checks complete for hosts without errors
  100. hosts: oo_masters_to_config:oo_etcd_to_config
  101. tasks:
  102. - set_fact:
  103. pre_upgrade_complete: True
  104. - import_playbook: label_nodes.yml
  105. - import_playbook: ../upgrade_control_plane.yml
  106. # All controllers must be stopped at the same time then restarted
  107. - name: Cycle all controller services to force new leader election mode
  108. hosts: oo_masters_to_config
  109. gather_facts: no
  110. roles:
  111. - role: openshift_facts
  112. tasks:
  113. - name: Restart master controllers to force new leader election mode
  114. service:
  115. name: "{{ openshift_service_type }}-master-controllers"
  116. state: restarted
  117. when: openshift_rolling_restart_mode | default('services') == 'services'
  118. - name: Re-enable master controllers to force new leader election mode
  119. service:
  120. name: "{{ openshift_service_type }}-master-controllers"
  121. enabled: true
  122. when: openshift_rolling_restart_mode | default('services') == 'system'
  123. - import_playbook: ../post_control_plane.yml
  124. - hosts: oo_masters
  125. tasks:
  126. - import_role:
  127. name: openshift_web_console
  128. tasks_from: remove_old_asset_config
  129. # This is for a migration for a dc/docker-registry env var
  130. # https://bugzilla.redhat.com/show_bug.cgi?id=1540467
  131. # OPENSHIFT_DEFAULT_REGISTRY to REGISTRY_OPENSHIFT_SERVER_ADDR
  132. - hosts: oo_first_master
  133. tasks:
  134. - import_role:
  135. name: openshift_hosted
  136. tasks_from: migrate_default_registry_var.yml