2019-04-17 14:14:02 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: RBD Provisioner | Remove legacy addon dir and manifests
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/rbd_provisioner"
|
|
|
|
state: absent
|
|
|
|
when:
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-17 14:14:02 +08:00
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
|
|
|
- name: RBD Provisioner | Remove legacy namespace
|
2022-01-05 18:26:32 +08:00
|
|
|
command: >
|
|
|
|
{{ kubectl }} delete namespace {{ rbd_provisioner_namespace }}
|
2022-01-11 16:45:16 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2019-04-17 14:14:02 +08:00
|
|
|
when:
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-17 14:14:02 +08:00
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
|
|
|
- name: RBD Provisioner | Remove legacy storageclass
|
2022-01-05 18:26:32 +08:00
|
|
|
command: >
|
|
|
|
{{ kubectl }} delete storageclass {{ rbd_provisioner_storage_class }}
|
2022-01-11 16:45:16 +08:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2019-04-17 14:14:02 +08:00
|
|
|
when:
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-17 14:14:02 +08:00
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
|
|
|
- name: RBD Provisioner | Create addon dir
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/rbd_provisioner"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
when:
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-17 14:14:02 +08:00
|
|
|
|
|
|
|
- name: RBD Provisioner | Templates list
|
|
|
|
set_fact:
|
|
|
|
rbd_provisioner_templates:
|
|
|
|
- { name: 00-namespace, file: 00-namespace.yml, type: ns }
|
|
|
|
- { name: secret-rbd-provisioner, file: secret-rbd-provisioner.yml, type: secret }
|
|
|
|
- { name: sa-rbd-provisioner, file: sa-rbd-provisioner.yml, type: sa }
|
|
|
|
- { name: clusterrole-rbd-provisioner, file: clusterrole-rbd-provisioner.yml, type: clusterrole }
|
|
|
|
- { name: clusterrolebinding-rbd-provisioner, file: clusterrolebinding-rbd-provisioner.yml, type: clusterrolebinding }
|
|
|
|
- { name: role-rbd-provisioner, file: role-rbd-provisioner.yml, type: role }
|
|
|
|
- { name: rolebinding-rbd-provisioner, file: rolebinding-rbd-provisioner.yml, type: rolebinding }
|
|
|
|
- { name: deploy-rbd-provisioner, file: deploy-rbd-provisioner.yml, type: deploy }
|
|
|
|
- { name: sc-rbd-provisioner, file: sc-rbd-provisioner.yml, type: sc }
|
|
|
|
|
|
|
|
- name: RBD Provisioner | Create manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/rbd_provisioner/{{ item.file }}"
|
2021-07-12 15:00:47 +08:00
|
|
|
mode: 0644
|
2019-04-17 14:14:02 +08:00
|
|
|
with_items: "{{ rbd_provisioner_templates }}"
|
|
|
|
register: rbd_provisioner_manifests
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-17 14:14:02 +08:00
|
|
|
|
|
|
|
- name: RBD Provisioner | Apply manifests
|
|
|
|
kube:
|
|
|
|
name: "{{ item.item.name }}"
|
|
|
|
namespace: "{{ rbd_provisioner_namespace }}"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/rbd_provisioner/{{ item.item.file }}"
|
|
|
|
state: "latest"
|
|
|
|
with_items: "{{ rbd_provisioner_manifests.results }}"
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|