upgrade.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ---
  2. - name: Stop control plane services
  3. service:
  4. name: "{{ item }}"
  5. state: stopped
  6. with_items:
  7. - "{{ openshift_service_type }}-master-api"
  8. - "{{ openshift_service_type }}-master-controllers"
  9. failed_when: false
  10. # Only needed for 3.10, remove in 3.11.
  11. - import_tasks: migrate_idproviders.yml
  12. - import_tasks: static_shim.yml
  13. - import_tasks: upgrade/upgrade_scheduler.yml
  14. # master_config_hook is passed in from upgrade play.
  15. - include_tasks: "upgrade/{{ master_config_hook }}"
  16. when: master_config_hook is defined
  17. - import_tasks: set_loopback_context.yml
  18. - name: Check for ca-bundle.crt
  19. stat:
  20. path: "{{ openshift.common.config_base }}/master/ca-bundle.crt"
  21. register: ca_bundle_stat
  22. failed_when: false
  23. - name: Check for ca.crt
  24. stat:
  25. path: "{{ openshift.common.config_base }}/master/ca.crt"
  26. register: ca_crt_stat
  27. failed_when: false
  28. - name: Migrate ca.crt to ca-bundle.crt
  29. command: mv ca.crt ca-bundle.crt
  30. args:
  31. chdir: "{{ openshift.common.config_base }}/master"
  32. when: ca_crt_stat.stat.isreg and not ca_bundle_stat.stat.exists
  33. - name: Link ca.crt to ca-bundle.crt
  34. file:
  35. src: "{{ openshift.common.config_base }}/master/ca-bundle.crt"
  36. path: "{{ openshift.common.config_base }}/master/ca.crt"
  37. state: link
  38. force: yes
  39. when: ca_crt_stat.stat.isreg and not ca_bundle_stat.stat.exists
  40. # Anyone upgrading to 3.7 or 3.9 should've had their certs updated to be
  41. # compatible with this so this is the only valid value for internal registry
  42. - name: Update imagePolicyConfig.internalRegistryHostname
  43. yedit:
  44. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  45. key: "imagePolicyConfig.internalRegistryHostname"
  46. value: "docker-registry.default.svc:5000"
  47. # TODO(michaelgugino): Remove in 3.11
  48. - name: Add new network config section to master conf
  49. yedit:
  50. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  51. key: networkConfig.clusterNetworks
  52. value: "{{ l_new_config_clusterNetworks }}"
  53. # l_existing_config_master_config is set via playbooks/init/basic_facts.yml
  54. when: l_existing_config_master_config.networkConfig.clusterNetworks is not defined
  55. # TODO(michaelgugino): Remove in 3.11
  56. - name: Remove old network config section in master conf
  57. yedit:
  58. src: /etc/origin/master/master-config.yaml
  59. key: "{{ item }}"
  60. state: absent
  61. with_items:
  62. - networkConfig.clusterNetworkCIDR
  63. - networkConfig.hostSubnetLength
  64. # TODO(michaelgugino): Remove in 3.11
  65. - name: Check for old master env file
  66. stat:
  67. path: "/etc/sysconfig/{{ openshift_service_type }}-master-api"
  68. register: old_env
  69. # TODO(michaelgugino): Remove in 3.11
  70. - name: Migrate old master env file to new location
  71. master_env_config_migrate:
  72. src: "/etc/sysconfig/{{ openshift_service_type }}-master-api"
  73. dest: "{{ openshift.common.config_base }}/master/master.env"
  74. when: old_env.stat.exists
  75. # TODO(michaelgugino): Remove in 3.11
  76. - name: mv old master env file to .backup
  77. command: "mv {{ l_old_env_file }} {{ l_old_env_file_backup }}"
  78. vars:
  79. l_old_env_file: "/etc/sysconfig/{{ openshift_service_type }}-master-api"
  80. l_old_env_file_backup: "/etc/sysconfig/{{ openshift_service_type }}-master-api.backup"
  81. when: old_env.stat.exists
  82. - name: Update oreg value
  83. yedit:
  84. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  85. key: 'imageConfig.format'
  86. value: "{{ oreg_url | default(oreg_url_master) }}"
  87. when: oreg_url is defined or oreg_url_master is defined
  88. - name: Change default node selector to compute=true
  89. yedit:
  90. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  91. key: 'projectConfig.defaultNodeSelector'
  92. value: '{{ hostvars[groups.oo_first_master.0].l_osm_default_node_selector }}'
  93. when: openshift_upgrade_target is version_compare('3.9', '>=')
  94. - name: Remove use of pod presets from master config
  95. yedit:
  96. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  97. key: 'admissionConfig.pluginConfig.PodPreset'
  98. state: absent
  99. - name: Find current value for runtime-config
  100. yedit:
  101. src: "/tmp/master-config.yaml"
  102. key: "kubernetesMasterConfig.apiServerArguments.runtime-config"
  103. state: list
  104. register: runtime_config
  105. - name: Set the runtime-config to exclude pod presets
  106. yedit:
  107. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  108. key: "kubernetesMasterConfig.apiServerArguments.runtime-config"
  109. value: "{{ runtime_config.result | join(',') | regex_replace('(?:,)*apis/settings\\.k8s\\.io/v1alpha1=true','') }}"
  110. when: runtime_config.result
  111. - name: Remove old service information
  112. file:
  113. path: "{{ item }}"
  114. state: absent
  115. with_items:
  116. - /etc/systemd/system/atomic-openshift-master-api.service
  117. - /etc/systemd/system/atomic-openshift-master-controllers.service
  118. - /etc/systemd/system/origin-master-api.service
  119. - /etc/systemd/system/origin-master-controllers.service
  120. - /usr/lib/systemd/system/atomic-openshift-master-api.service
  121. - /usr/lib/systemd/system/atomic-openshift-master-controllers.service
  122. - /usr/lib/systemd/system/origin-master-api.service
  123. - /usr/lib/systemd/system/origin-master-controllers.service
  124. - name: reload systemd units
  125. command: systemctl daemon-reload