post_control_plane.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ---
  2. ####################################################################################
  3. # Post upgrade - Upgrade web console, default router, default registry, and examples
  4. ####################################################################################
  5. - name: Upgrade web console
  6. hosts: oo_first_master
  7. roles:
  8. - role: openshift_web_console
  9. when:
  10. - openshift_web_console_install | default(true) | bool
  11. - openshift_upgrade_target is version_compare('3.9','>=')
  12. - name: Upgrade default router and default registry
  13. hosts: oo_first_master
  14. vars:
  15. registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) |
  16. replace ( '${version}', openshift_image_tag ) }}"
  17. router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) |
  18. replace ( '${version}', openshift_image_tag ) }}"
  19. registry_console_image: "{{ openshift.master.registry_url | regex_replace ( '(origin|ose)-\\${component}', 'registry-console') |
  20. replace ( '${version}', 'v' ~ openshift.common.short_version ) }}"
  21. pre_tasks:
  22. - name: Load lib_openshift modules
  23. import_role:
  24. name: lib_openshift
  25. - name: Collect all routers
  26. oc_obj:
  27. state: list
  28. kind: pods
  29. all_namespaces: True
  30. selector: 'router'
  31. register: all_routers
  32. - set_fact:
  33. haproxy_routers: "{{ all_routers.results.results[0]['items'] |
  34. lib_utils_oo_pods_match_component(openshift_deployment_type, 'haproxy-router') |
  35. lib_utils_oo_select_keys_from_list(['metadata']) }}"
  36. when:
  37. - all_routers.results.returncode == 0
  38. - set_fact: haproxy_routers=[]
  39. when:
  40. - all_routers.results.returncode != 0
  41. - name: Update router image to current version
  42. oc_edit:
  43. kind: dc
  44. name: "{{ item['labels']['deploymentconfig'] }}"
  45. namespace: "{{ item['namespace'] }}"
  46. content:
  47. spec.template.spec.containers[0].image: "{{ router_image }}"
  48. with_items: "{{ haproxy_routers }}"
  49. when:
  50. - all_routers.results.returncode == 0
  51. - name: Check for default registry
  52. oc_obj:
  53. state: list
  54. kind: dc
  55. name: docker-registry
  56. register: _default_registry
  57. - name: Update registry image to current version
  58. oc_edit:
  59. kind: dc
  60. name: docker-registry
  61. namespace: default
  62. content:
  63. spec.template.spec.containers[0].image: "{{ registry_image }}"
  64. when:
  65. - _default_registry.results.results[0] != {}
  66. - name: Check for registry-console
  67. oc_obj:
  68. state: list
  69. kind: dc
  70. name: registry-console
  71. register: _registry_console
  72. when:
  73. - openshift.common.deployment_type != 'origin'
  74. - name: Update registry-console image to current version
  75. oc_edit:
  76. kind: dc
  77. name: registry-console
  78. namespace: default
  79. content:
  80. spec.template.spec.containers[0].image: "{{ registry_console_image }}"
  81. when:
  82. - openshift.common.deployment_type != 'origin'
  83. - _registry_console.results.results[0] != {}
  84. roles:
  85. - openshift_manageiq
  86. - role: openshift_project_request_template
  87. when: openshift_project_request_template_manage
  88. # Create the new templates shipped in 3.2, existing templates are left
  89. # unmodified. This prevents the subsequent role definition for
  90. # openshift_examples from failing when trying to replace templates that do
  91. # not already exist. We could have potentially done a replace --force to
  92. # create and update in one step.
  93. - role: openshift_examples
  94. when: openshift_install_examples | default(true) | bool
  95. - openshift_hosted_templates
  96. # Update the existing templates
  97. - role: openshift_examples
  98. when: openshift_install_examples | default(true) | bool
  99. registry_url: "{{ openshift.master.registry_url }}"
  100. openshift_examples_import_command: replace
  101. - role: openshift_hosted_templates
  102. registry_url: "{{ openshift.master.registry_url }}"
  103. openshift_hosted_templates_import_command: replace
  104. # Check for warnings to be printed at the end of the upgrade:
  105. - name: Clean up and display warnings
  106. hosts: oo_masters_to_config
  107. tags:
  108. - always
  109. gather_facts: no
  110. roles:
  111. - role: openshift_excluder
  112. r_openshift_excluder_action: enable
  113. post_tasks:
  114. # Check if any masters are using pluginOrderOverride and warn if so, only for 1.3/3.3 and beyond:
  115. - name: grep pluginOrderOverride
  116. command: grep pluginOrderOverride {{ openshift.common.config_base }}/master/master-config.yaml
  117. register: grep_plugin_order_override
  118. changed_when: false
  119. failed_when: false
  120. - name: Warn if pluginOrderOverride is in use in master-config.yaml
  121. debug:
  122. msg: "WARNING pluginOrderOverride is being deprecated in master-config.yaml, please see https://docs.openshift.com/enterprise/latest/architecture/additional_concepts/admission_controllers.html for more information."
  123. when:
  124. - not (grep_plugin_order_override is skipped)
  125. - grep_plugin_order_override.rc == 0
  126. - name: Warn if shared-resource-viewer could not be updated
  127. debug:
  128. msg: "WARNING the shared-resource-viewer role could not be upgraded to 3.6 spec because it's marked protected, please see https://bugzilla.redhat.com/show_bug.cgi?id=1493213"
  129. when:
  130. - __shared_resource_viewer_protected | default(false)