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.

75 lines
2.3 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. force: yes
  20. with_items:
  21. - {s: "ca.pem", d: "ca_cert.crt"}
  22. - {s: "node-{{ inventory_hostname }}.pem", d: "cert.crt"}
  23. - {s: "node-{{ inventory_hostname }}-key.pem", d: "key.pem"}
  24. - name: Canal | Set Flannel etcd configuration
  25. command: |-
  26. {{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \
  27. set /{{ cluster_name }}/network/config \
  28. '{ "Network": "{{ kube_pods_subnet }}", "SubnetLen": {{ kube_network_node_prefix }}, "Backend": { "Type": "{{ flannel_backend_type }}" } }'
  29. delegate_to: "{{groups['etcd'][0]}}"
  30. run_once: true
  31. - name: Canal | Write canal configmap
  32. template:
  33. src: canal-config.yml.j2
  34. dest: "{{kube_config_dir}}/canal-config.yaml"
  35. - name: Canal | Write canal node configuration
  36. template:
  37. src: canal-node.yml.j2
  38. dest: "{{kube_config_dir}}/canal-node.yaml"
  39. - name: Canal | Copy cni plugins from hyperkube
  40. command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/rsync -a /opt/cni/bin/ /cnibindir/"
  41. register: cni_task_result
  42. until: cni_task_result.rc == 0
  43. retries: 4
  44. delay: "{{ retry_stagger | random + 3 }}"
  45. changed_when: false
  46. tags: [hyperkube, upgrade]
  47. - name: Canal | Copy cni plugins from calico/cni
  48. command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp -a /opt/cni/bin/* /cnibindir/'"
  49. register: cni_task_result
  50. until: cni_task_result.rc == 0
  51. retries: 4
  52. delay: "{{ retry_stagger | random + 3 }}"
  53. changed_when: false
  54. tags: [hyperkube, upgrade]
  55. - name: Canal | Install calicoctl container script
  56. template:
  57. src: calicoctl-container.j2
  58. dest: "{{ bin_dir }}/calicoctl"
  59. mode: 0755
  60. owner: root
  61. group: root
  62. changed_when: false
  63. - name: Canal | Create network policy directory
  64. file:
  65. path: "{{ canal_policy_dir }}"
  66. state: directory