2020-04-20 15:47:39 +00:00
|
|
|
---
|
|
|
|
- include_tasks: vsphere-credentials-check.yml
|
|
|
|
tags: vsphere-csi-driver
|
|
|
|
|
|
|
|
- name: vSphere CSI Driver | Generate CSI cloud-config
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item }}"
|
|
|
|
mode: 0640
|
|
|
|
with_items:
|
|
|
|
- vsphere-csi-cloud-config
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 15:47:39 +00:00
|
|
|
tags: vsphere-csi-driver
|
|
|
|
|
|
|
|
- name: vSphere CSI Driver | Generate Manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item }}"
|
2022-01-09 09:51:12 +00:00
|
|
|
mode: 0644
|
2020-04-20 15:47:39 +00:00
|
|
|
with_items:
|
2021-12-10 19:07:23 +00:00
|
|
|
- vsphere-csi-driver.yml
|
2020-04-20 15:47:39 +00:00
|
|
|
- vsphere-csi-controller-rbac.yml
|
2021-12-10 19:07:23 +00:00
|
|
|
- vsphere-csi-node-rbac.yml
|
|
|
|
- vsphere-csi-controller-config.yml
|
|
|
|
- vsphere-csi-controller-deployment.yml
|
|
|
|
- vsphere-csi-controller-service.yml
|
2020-04-20 15:47:39 +00:00
|
|
|
- vsphere-csi-node.yml
|
|
|
|
register: vsphere_csi_manifests
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 15:47:39 +00:00
|
|
|
tags: vsphere-csi-driver
|
|
|
|
|
2020-06-02 12:42:15 +00:00
|
|
|
- name: vSphere CSI Driver | Generate a CSI secret manifest
|
2022-01-05 10:26:32 +00:00
|
|
|
command: "{{ kubectl }} create secret generic vsphere-config-secret --from-file=csi-vsphere.conf={{ kube_config_dir }}/vsphere-csi-cloud-config -n kube-system --dry-run --save-config -o yaml"
|
2020-06-02 12:42:15 +00:00
|
|
|
register: vsphere_csi_secret_manifest
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-06-02 12:42:15 +00:00
|
|
|
no_log: true
|
|
|
|
tags: vsphere-csi-driver
|
|
|
|
|
|
|
|
- name: vSphere CSI Driver | Apply a CSI secret manifest
|
|
|
|
command:
|
2022-01-05 10:26:32 +00:00
|
|
|
cmd: "{{ kubectl }} apply -f -"
|
2020-06-02 12:42:15 +00:00
|
|
|
stdin: "{{ vsphere_csi_secret_manifest.stdout }}"
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-06-02 12:42:15 +00:00
|
|
|
no_log: true
|
2020-04-20 15:47:39 +00:00
|
|
|
tags: vsphere-csi-driver
|
|
|
|
|
|
|
|
- name: vSphere CSI Driver | Apply Manifests
|
|
|
|
kube:
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
filename: "{{ kube_config_dir }}/{{ item.item }}"
|
|
|
|
state: "latest"
|
|
|
|
with_items:
|
|
|
|
- "{{ vsphere_csi_manifests.results }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 15:47:39 +00:00
|
|
|
- not item is skipped
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.item }}"
|
|
|
|
tags: vsphere-csi-driver
|