You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB

  1. ---
  2. - name: Canal | Write Canal cni config
  3. template:
  4. src: "cni-canal.conf.j2"
  5. dest: "/etc/cni/net.d/10-canal.conf"
  6. owner: kube
  7. - name: Canal | Create canal certs directory
  8. file:
  9. dest: "{{ canal_cert_dir }}"
  10. state: directory
  11. mode: 0750
  12. owner: root
  13. group: root
  14. - name: Canal | Link etcd certificates for canal-node
  15. file:
  16. src: "{{ etcd_cert_dir }}/{{ item.s }}"
  17. dest: "{{ canal_cert_dir }}/{{ item.d }}"
  18. state: hard
  19. with_items:
  20. - {s: "ca.pem", d: "ca_cert.crt"}
  21. - {s: "node.pem", d: "cert.crt"}
  22. - {s: "node-key.pem", d: "key.pem"}
  23. - name: Canal | Set Flannel etcd configuration
  24. command: |-
  25. {{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \
  26. set /{{ cluster_name }}/network/config \
  27. '{ "Network": "{{ kube_pods_subnet }}", "SubnetLen": {{ kube_network_node_prefix }}, "Backend": { "Type": "{{ flannel_backend_type }}" } }'
  28. delegate_to: "{{groups['etcd'][0]}}"
  29. run_once: true
  30. - name: Canal | Write canal configmap
  31. template:
  32. src: canal-config.yml.j2
  33. dest: /etc/kubernetes/canal-config.yaml
  34. - name: Canal | Write canal node configuration
  35. template:
  36. src: canal-node.yml.j2
  37. dest: /etc/kubernetes/canal-node.yaml
  38. - name: Canal | Copy cni plugins from hyperkube
  39. command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/rsync -a /opt/cni/bin/ /cnibindir/"
  40. register: cni_task_result
  41. until: cni_task_result.rc == 0
  42. retries: 4
  43. delay: "{{ retry_stagger | random + 3 }}"
  44. changed_when: false
  45. - name: Canal | Copy cni plugins from calico/cni
  46. command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp -a /opt/cni/bin/* /cnibindir/'"
  47. register: cni_task_result
  48. until: cni_task_result.rc == 0
  49. retries: 4
  50. delay: "{{ retry_stagger | random + 3 }}"
  51. changed_when: false