c12s-kubespray/roles/kubernetes-apps/external_cloud_controller/vsphere/tasks/main.yml
2020-04-20 08:47:39 -07:00

45 lines
1.6 KiB
YAML

---
- include_tasks: vsphere-credentials-check.yml
tags: external-vsphere
- name: External vSphere Cloud Controller | Generate CPI cloud-config
template:
src: "{{ item }}.j2"
dest: "{{ kube_config_dir }}/{{ item }}"
mode: 0640
with_items:
- external-vsphere-cpi-cloud-config
when: inventory_hostname == groups['kube-master'][0]
tags: external-vsphere
- name: External vSphere Cloud Controller | Generate Manifests
template:
src: "{{ item }}.j2"
dest: "{{ kube_config_dir }}/{{ item }}"
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
when: inventory_hostname == groups['kube-master'][0]
tags: external-vsphere
- name: External vSphere Cloud Provider Interface | Create a CPI configMap
command: "{{ bin_dir }}/kubectl create configmap cloud-config --from-file=vsphere.conf={{ kube_config_dir }}/external-vsphere-cpi-cloud-config -n kube-system"
when: inventory_hostname == groups['kube-master'][0]
tags: external-vsphere
- 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:
- inventory_hostname == groups['kube-master'][0]
- not item is skipped
loop_control:
label: "{{ item.item }}"
tags: external-vsphere