2020-04-20 23:47:39 +08:00
|
|
|
---
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Check vsphare credentials
|
|
|
|
include_tasks: vsphere-credentials-check.yml
|
2020-04-20 23:47:39 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Generate CSI cloud-config
|
2020-04-20 23:47:39 +08:00
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item }}"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0640"
|
2020-04-20 23:47:39 +08:00
|
|
|
with_items:
|
|
|
|
- vsphere-csi-cloud-config
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 23:47:39 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Generate Manifests
|
2020-04-20 23:47:39 +08:00
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item }}"
|
2024-07-26 09:42:20 +08:00
|
|
|
mode: "0644"
|
2020-04-20 23:47:39 +08:00
|
|
|
with_items:
|
2022-09-15 17:01:23 +08:00
|
|
|
- vsphere-csi-namespace.yml
|
2021-12-11 03:07:23 +08:00
|
|
|
- vsphere-csi-driver.yml
|
2020-04-20 23:47:39 +08:00
|
|
|
- vsphere-csi-controller-rbac.yml
|
2021-12-11 03:07:23 +08:00
|
|
|
- vsphere-csi-node-rbac.yml
|
|
|
|
- vsphere-csi-controller-config.yml
|
|
|
|
- vsphere-csi-controller-deployment.yml
|
|
|
|
- vsphere-csi-controller-service.yml
|
2020-04-20 23:47:39 +08:00
|
|
|
- vsphere-csi-node.yml
|
|
|
|
register: vsphere_csi_manifests
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 23:47:39 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Apply Manifests
|
2020-04-20 23:47:39 +08:00
|
|
|
kube:
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
filename: "{{ kube_config_dir }}/{{ item.item }}"
|
|
|
|
state: "latest"
|
|
|
|
with_items:
|
|
|
|
- "{{ vsphere_csi_manifests.results }}"
|
|
|
|
when:
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 23:47:39 +08:00
|
|
|
- not item is skipped
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.item }}"
|
2023-04-10 13:13:15 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Generate a CSI secret manifest
|
2023-04-10 13:13:15 +08:00
|
|
|
command: "{{ kubectl }} create secret generic vsphere-config-secret --from-file=csi-vsphere.conf={{ kube_config_dir }}/vsphere-csi-cloud-config -n {{ vsphere_csi_namespace }} --dry-run --save-config -o yaml"
|
|
|
|
register: vsphere_csi_secret_manifest
|
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2023-07-05 11:36:54 +08:00
|
|
|
no_log: "{{ not (unsafe_show_logs | bool) }}"
|
2023-04-10 13:13:15 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: VSphere CSI Driver | Apply a CSI secret manifest
|
2023-04-10 13:13:15 +08:00
|
|
|
command:
|
|
|
|
cmd: "{{ kubectl }} apply -f -"
|
|
|
|
stdin: "{{ vsphere_csi_secret_manifest.stdout }}"
|
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2023-07-05 11:36:54 +08:00
|
|
|
no_log: "{{ not (unsafe_show_logs | bool) }}"
|