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.

77 lines
2.2 KiB

  1. ---
  2. - name: Set docker daemon options
  3. template:
  4. src: docker
  5. dest: "/etc/default/docker"
  6. owner: root
  7. group: root
  8. mode: 0644
  9. notify:
  10. - restart docker
  11. - name: Weave | Determine hyperkube cni to use depending of the version of kube
  12. set_fact:
  13. use_hyperkube_cni: >
  14. {%- if kube_version | version_compare('v1.3.4','>=') -%}
  15. true
  16. {%- elif kube_version | version_compare('v1.3.4','<') -%}
  17. false
  18. {%- else -%}
  19. {{ ErrorCannotRecognizeVersion }}
  20. {%- endif -%}
  21. - name: Weave | Copy cni plugins from hyperkube
  22. command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -r /opt/cni/bin/. /cnibindir/"
  23. register: cni_task_result
  24. until: cni_task_result.rc == 0
  25. retries: 4
  26. delay: "{{ retry_stagger | random + 3 }}"
  27. changed_when: false
  28. when: "{{ use_hyperkube_cni|bool }}"
  29. - name: Weave | Install weave
  30. command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave"
  31. changed_when: false
  32. - name: Weave | pull weave images
  33. shell: "{{ bin_dir }}/weave setup"
  34. changed_when: false
  35. - name: Weave | set perms
  36. file: path="{{ bin_dir }}/weave" mode=0755 state=file
  37. - name: Weave | Set options
  38. template:
  39. src: weave.j2
  40. dest: "/etc/weave.env"
  41. owner: root
  42. group: root
  43. mode: 0644
  44. notify:
  45. - restart weave
  46. - name: Weave | Write weave systemd init file
  47. template: src=weave.service.j2 dest=/etc/systemd/system/weave.service
  48. when: ansible_service_mgr == "systemd"
  49. notify: restart weave
  50. - name: Weave | Write weaveproxy systemd init file
  51. template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service
  52. when: ansible_service_mgr == "systemd"
  53. notify: restart weaveproxy
  54. - name: Weave | Write weaveexpose systemd init file
  55. template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service
  56. when: ansible_service_mgr == "systemd"
  57. notify: restart weaveexpose
  58. - meta: flush_handlers
  59. - name: Weave | Enable weave
  60. service: name=weave enabled=yes state=started
  61. - name: Weave | Enable weaveproxy
  62. service: name=weaveproxy enabled=yes state=started
  63. - name: Weave | Enable weaveexpose
  64. service: name=weaveexpose enabled=yes state=started