2020-03-11 20:13:36 +08:00
|
|
|
---
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: Remove old cloud provider config
|
|
|
|
hosts: kube_node:kube_control_plane
|
2020-03-11 20:13:36 +08:00
|
|
|
tasks:
|
|
|
|
- name: Remove old cloud provider config
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- /etc/kubernetes/cloud_config
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: Migrate intree Cinder PV
|
|
|
|
hosts: kube_control_plane[0]
|
2020-03-11 20:13:36 +08:00
|
|
|
tasks:
|
|
|
|
- name: Include kubespray-default variables
|
2023-12-11 23:56:17 +08:00
|
|
|
include_vars: ../roles/kubespray-defaults/defaults/main/main.yml
|
2020-03-11 20:13:36 +08:00
|
|
|
- name: Copy get_cinder_pvs.sh to master
|
|
|
|
copy:
|
|
|
|
src: get_cinder_pvs.sh
|
|
|
|
dest: /tmp
|
|
|
|
mode: u+rwx
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Get PVs provisioned by in-tree cloud provider
|
2020-03-11 20:13:36 +08:00
|
|
|
command: /tmp/get_cinder_pvs.sh
|
|
|
|
register: pvs
|
|
|
|
- name: Remove get_cinder_pvs.sh
|
|
|
|
file:
|
|
|
|
path: /tmp/get_cinder_pvs.sh
|
|
|
|
state: absent
|
2023-06-30 17:51:57 +08:00
|
|
|
- name: Rewrite the "pv.kubernetes.io/provisioned-by" annotation
|
2020-03-11 20:13:36 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl annotate --overwrite pv {{ item }} pv.kubernetes.io/provisioned-by=cinder.csi.openstack.org"
|
|
|
|
loop: "{{ pvs.stdout_lines | list }}"
|