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.

61 lines
1.8 KiB

9 years ago
9 years ago
  1. ---
  2. - name: Flannel | Set Flannel etcd configuration
  3. command: |-
  4. {{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \
  5. set /{{ cluster_name }}/network/config \
  6. '{ "Network": "{{ kube_pods_subnet }}", "SubnetLen": {{ kube_network_node_prefix }}, "Backend": { "Type": "{{ flannel_backend_type }}" } }'
  7. delegate_to: "{{groups['etcd'][0]}}"
  8. run_once: true
  9. - name: Flannel | Create flannel pod manifest
  10. template:
  11. src: flannel-pod.yml
  12. dest: /etc/kubernetes/manifests/flannel-pod.manifest
  13. notify: delete default docker bridge
  14. - name: Flannel | Wait for flannel subnet.env file presence
  15. wait_for:
  16. path: /run/flannel/subnet.env
  17. delay: 5
  18. timeout: 600
  19. - name: Flannel | Get flannel_subnet from subnet.env
  20. shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_SUBNET" {print $2}'
  21. register: flannel_subnet_output
  22. changed_when: false
  23. - set_fact:
  24. flannel_subnet: "{{ flannel_subnet_output.stdout }}"
  25. - name: Flannel | Get flannel_mtu from subnet.env
  26. shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_MTU" {print $2}'
  27. register: flannel_mtu_output
  28. changed_when: false
  29. - set_fact:
  30. flannel_mtu: "{{ flannel_mtu_output.stdout }}"
  31. - name: Flannel | Set docker daemon options
  32. template:
  33. src: docker
  34. dest: "/etc/default/docker"
  35. owner: root
  36. group: root
  37. mode: 0644
  38. notify:
  39. - restart docker
  40. when: ansible_os_family != "CoreOS"
  41. - name: Flannel | Create docker service path for CoreOS
  42. file: path=/etc/systemd/system/docker.service.d state=directory
  43. when: ansible_os_family == "CoreOS"
  44. - name: Flannel | Create docker dropin for CoreOS
  45. template:
  46. src: docker-systemd
  47. dest: "/etc/systemd/system/docker.service.d/flannel-options.conf"
  48. notify:
  49. - restart docker
  50. when: ansible_os_family == "CoreOS"
  51. - meta: flush_handlers