---
# https://github.com/flannel-io/flannel/blob/master/Documentation/kubernetes.md
- name: Sync flannel package to remote
  copy:
    src: >-
      {{ .binary_dir }}/cni/flannel/flannel.tgz
    dest: /etc/kubernetes/cni/flannel.tgz

- name: Generate flannel custom value file
  copy:
    content: |
      {{ .cni.flannel.values }}
    dest: /etc/kubernetes/cni/flannel-values.yaml

- name: Apply flannel
  command: |
    helm upgrade --install --create-namespace --namespace kube-flannel flannel /etc/kubernetes/cni/flannel.tgz -f /etc/kubernetes/cni/flannel-values.yaml
