upgrade_control_plane.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. ## Check to see if they're running 3.7 and if so upgrade them to 3.8 on control plan
  19. ## If they've specified pkg_version or image_tag preserve that for later use
  20. - name: Configure the upgrade target for the common upgrade tasks 3.8
  21. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  22. tasks:
  23. - set_fact:
  24. openshift_upgrade_target: '3.8'
  25. openshift_upgrade_min: '3.7'
  26. openshift_release: '3.8'
  27. _requested_pkg_version: "{{openshift_pkg_version if openshift_pkg_version is defined else omit }}"
  28. _requested_image_tag: "{{openshift_image_tag if openshift_image_tag is defined else omit }}"
  29. when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
  30. - import_playbook: ../pre/config.yml
  31. # These vars a meant to exclude oo_nodes from plays that would otherwise include
  32. # them by default.
  33. vars:
  34. l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
  35. l_openshift_version_check_hosts: "oo_masters_to_config:!oo_first_master"
  36. l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  37. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  38. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  39. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  40. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  41. l_upgrade_excluder_hosts: "oo_masters_to_config"
  42. openshift_protect_installed_version: False
  43. when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
  44. - name: Flag pre-upgrade checks complete for hosts without errors 3.8
  45. hosts: oo_masters_to_config:oo_etcd_to_config
  46. tasks:
  47. - set_fact:
  48. pre_upgrade_complete: True
  49. when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
  50. # Pre-upgrade completed
  51. - import_playbook: ../upgrade_control_plane.yml
  52. vars:
  53. openshift_release: '3.8'
  54. when: hostvars[groups.oo_first_master.0].openshift_currently_installed_version | version_compare('3.8','<')
  55. ## 3.8 upgrade complete we should now be able to upgrade to 3.9
  56. - name: Configure the upgrade target for the common upgrade tasks 3.9
  57. hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  58. tasks:
  59. - meta: clear_facts
  60. - set_fact:
  61. openshift_upgrade_target: '3.9'
  62. openshift_upgrade_min: '3.8'
  63. openshift_release: '3.9'
  64. openshift_pkg_version: "{{ _requested_pkg_version | default ('-3.9*') }}"
  65. openshift_image_tag: "{{ _requested_image_tag | default('v3.9') }}"
  66. - import_playbook: ../pre/config.yml
  67. # These vars a meant to exclude oo_nodes from plays that would otherwise include
  68. # them by default.
  69. vars:
  70. l_openshift_version_set_hosts: "oo_etcd_to_config:oo_masters_to_config:!oo_first_master"
  71. l_openshift_version_check_hosts: "oo_masters_to_config:!oo_first_master"
  72. l_upgrade_repo_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  73. l_upgrade_no_proxy_hosts: "oo_masters_to_config"
  74. l_upgrade_health_check_hosts: "oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config"
  75. l_upgrade_verify_targets_hosts: "oo_masters_to_config"
  76. l_upgrade_docker_target_hosts: "oo_masters_to_config:oo_etcd_to_config"
  77. l_upgrade_excluder_hosts: "oo_masters_to_config"
  78. openshift_protect_installed_version: False
  79. - name: Flag pre-upgrade checks complete for hosts without errors
  80. hosts: oo_masters_to_config:oo_etcd_to_config
  81. tasks:
  82. - set_fact:
  83. pre_upgrade_complete: True
  84. - import_playbook: ../upgrade_control_plane.yml
  85. vars:
  86. openshift_release: '3.9'
  87. # All controllers must be stopped at the same time then restarted
  88. - name: Cycle all controller services to force new leader election mode
  89. hosts: oo_masters_to_config
  90. gather_facts: no
  91. roles:
  92. - role: openshift_facts
  93. tasks:
  94. - name: Stop {{ openshift_service_type }}-master-controllers
  95. systemd:
  96. name: "{{ openshift_service_type }}-master-controllers"
  97. state: stopped
  98. - name: Start {{ openshift_service_type }}-master-controllers
  99. systemd:
  100. name: "{{ openshift_service_type }}-master-controllers"
  101. state: started
  102. - import_playbook: ../post_control_plane.yml
  103. - hosts: oo_masters
  104. tasks:
  105. - import_role:
  106. name: openshift_web_console
  107. tasks_from: remove_old_asset_config