2020-04-20 23:47:39 +08:00
|
|
|
---
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: External vSphere Cloud Controller | Check vsphere credentials
|
|
|
|
include_tasks: vsphere-credentials-check.yml
|
2020-04-20 23:47:39 +08:00
|
|
|
|
|
|
|
- name: External vSphere Cloud Controller | Generate CPI cloud-config
|
|
|
|
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:
|
|
|
|
- external-vsphere-cpi-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
|
|
|
|
|
|
|
- name: External vSphere Cloud Controller | Generate Manifests
|
|
|
|
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:
|
|
|
|
- external-vsphere-cpi-cloud-config-secret.yml
|
|
|
|
- external-vsphere-cloud-controller-manager-roles.yml
|
|
|
|
- external-vsphere-cloud-controller-manager-role-bindings.yml
|
|
|
|
- external-vsphere-cloud-controller-manager-ds.yml
|
|
|
|
register: external_vsphere_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
|
|
|
|
2020-06-02 20:42:15 +08:00
|
|
|
- name: External vSphere Cloud Provider Interface | Create a CPI configMap manifest
|
|
|
|
command: "{{ bin_dir }}/kubectl create configmap cloud-config --from-file=vsphere.conf={{ kube_config_dir }}/external-vsphere-cpi-cloud-config -n kube-system --dry-run --save-config -o yaml"
|
|
|
|
register: external_vsphere_configmap_manifest
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-06-02 20:42:15 +08:00
|
|
|
|
|
|
|
- name: External vSphere Cloud Provider Interface | Apply a CPI configMap manifest
|
|
|
|
command:
|
|
|
|
cmd: "{{ bin_dir }}/kubectl apply -f -"
|
|
|
|
stdin: "{{ external_vsphere_configmap_manifest.stdout }}"
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-04-20 23:47:39 +08:00
|
|
|
|
|
|
|
- name: External vSphere Cloud Controller | Apply Manifests
|
|
|
|
kube:
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
filename: "{{ kube_config_dir }}/{{ item.item }}"
|
|
|
|
state: "latest"
|
|
|
|
with_items:
|
|
|
|
- "{{ external_vsphere_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 }}"
|