123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- ---
- - name: Stop control plane services
- service:
- name: "{{ item }}"
- state: stopped
- with_items:
- - "{{ openshift_service_type }}-master-api"
- - "{{ openshift_service_type }}-master-controllers"
- failed_when: false
- # Only needed for 3.10, remove in 3.11.
- - import_tasks: migrate_idproviders.yml
- - import_tasks: static_shim.yml
- - import_tasks: upgrade/upgrade_scheduler.yml
- # master_config_hook is passed in from upgrade play.
- - include_tasks: "upgrade/{{ master_config_hook }}"
- when: master_config_hook is defined
- - import_tasks: set_loopback_context.yml
- - name: Check for ca-bundle.crt
- stat:
- path: "{{ openshift.common.config_base }}/master/ca-bundle.crt"
- register: ca_bundle_stat
- failed_when: false
- - name: Check for ca.crt
- stat:
- path: "{{ openshift.common.config_base }}/master/ca.crt"
- register: ca_crt_stat
- failed_when: false
- - name: Migrate ca.crt to ca-bundle.crt
- command: mv ca.crt ca-bundle.crt
- args:
- chdir: "{{ openshift.common.config_base }}/master"
- when: ca_crt_stat.stat.isreg and not ca_bundle_stat.stat.exists
- - name: Link ca.crt to ca-bundle.crt
- file:
- src: "{{ openshift.common.config_base }}/master/ca-bundle.crt"
- path: "{{ openshift.common.config_base }}/master/ca.crt"
- state: link
- force: yes
- when: ca_crt_stat.stat.isreg and not ca_bundle_stat.stat.exists
- - name: Find existing master sysconfig
- find:
- paths:
- - /etc/sysconfig
- patterns:
- - openshift-master-api
- - openshift-master-controllers
- - origin-master-api
- - origin-master-controllers
- register: sysconfigs
- - when: sysconfigs|succeeded and sysconfigs.matched > 0
- name: Migrate OPENSHIFT_DEFAULT_REGISTRY from master sysconfig to master-config.yaml
- block:
- - name: Get master sysconfig contents
- slurp:
- src: "{{ sysconfigs.files[0].path }}"
- register: sysconfig
- # TODO: surely there is a better way
- - name: Update imagePolicyConfig.internalRegistryHostname
- yedit:
- src: "{{ openshift.common.config_base }}/master/master-config.yaml"
- key: "imagePolicyConfig.internalRegistryHostname"
- value: "{{ item | regex_replace('^OPENSHIFT_DEFAULT_REGISTRY=\\s*([^#\\s]+).*','\\1') }}"
- with_items: "{{ (sysconfig.content | b64decode).split('\n') | select('match','^OPENSHIFT_DEFAULT_REGISTRY=\\s*.+') | list }}"
- - name: Create the master service env file if it does not exist
- template:
- src: "master.env.j2"
- dest: "{{ openshift.common.config_base }}/master/master.env"
- force: no
- - name: Update oreg value
- yedit:
- src: "{{ openshift.common.config_base }}/master/master-config.yaml"
- key: 'imageConfig.format'
- value: "{{ oreg_url | default(oreg_url_master) }}"
- when: oreg_url is defined or oreg_url_master is defined
- - name: Change default node selector to compute=true
- yedit:
- src: "{{ openshift.common.config_base }}/master/master-config.yaml"
- key: 'projectConfig.defaultNodeSelector'
- value: '{{ hostvars[groups.oo_first_master.0].l_osm_default_node_selector }}'
- when: openshift_upgrade_target | version_compare('3.9', '>=')
- - name: Remove use of pod presets from master config
- yedit:
- src: "{{ openshift.common.config_base }}/master/master-config.yaml"
- key: 'admissionConfig.pluginConfig.PodPreset'
- state: absent
- - name: Find current value for runtime-config
- yedit:
- src: "/tmp/master-config.yaml"
- key: "kubernetesMasterConfig.apiServerArguments.runtime-config"
- state: list
- register: runtime_config
- - name: Set the runtime-config to exclude pod presets
- yedit:
- src: "{{ openshift.common.config_base }}/master/master-config.yaml"
- key: "kubernetesMasterConfig.apiServerArguments.runtime-config"
- value: "{{ runtime_config.result | join(',') | regex_replace('(?:,)*apis/settings\\.k8s\\.io/v1alpha1=true','') }}"
- when: runtime_config.result
- - name: Remove old service information
- file:
- path: "{{ item }}"
- state: absent
- with_items:
- - /etc/systemd/system/atomic-openshift-master-api.service
- - /etc/systemd/system/atomic-openshift-master-controllers.service
- - /etc/systemd/system/origin-master-api.service
- - /etc/systemd/system/origin-master-controllers.service
- - /usr/lib/systemd/system/atomic-openshift-master-api.service
- - /usr/lib/systemd/system/atomic-openshift-master-controllers.service
- - /usr/lib/systemd/system/origin-master-api.service
- - /usr/lib/systemd/system/origin-master-controllers.service
- - name: reload systemd units
- command: systemctl daemon-reload
|