2016-02-10 00:16:16 +08:00
|
|
|
---
|
|
|
|
- name: Set docker daemon options
|
|
|
|
template:
|
|
|
|
src: docker
|
|
|
|
dest: "/etc/default/docker"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify:
|
2016-08-02 18:42:27 +08:00
|
|
|
- restart docker
|
2016-02-10 00:16:16 +08:00
|
|
|
|
2016-09-26 17:02:19 +08:00
|
|
|
- name: Weave | Determine hyperkube cni to use depending of the version of kube
|
|
|
|
set_fact:
|
|
|
|
use_hyperkube_cni: >
|
|
|
|
{%- if kube_version | version_compare('v1.3.4','>=') -%}
|
|
|
|
true
|
|
|
|
{%- elif kube_version | version_compare('v1.3.4','<') -%}
|
|
|
|
false
|
|
|
|
{%- else -%}
|
|
|
|
{{ ErrorCannotRecognizeVersion }}
|
|
|
|
{%- endif -%}
|
|
|
|
|
|
|
|
- name: Weave | Copy cni plugins from hyperkube
|
|
|
|
command: "/usr/bin/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -r /opt/cni/bin/. /cnibindir/"
|
|
|
|
register: cni_task_result
|
|
|
|
until: cni_task_result.rc == 0
|
|
|
|
retries: 4
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
changed_when: false
|
|
|
|
when: "{{ use_hyperkube_cni|bool }}"
|
|
|
|
|
2016-02-10 00:16:16 +08:00
|
|
|
- name: Weave | Install weave
|
|
|
|
command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave"
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: Weave | pull weave images
|
|
|
|
shell: "{{ bin_dir }}/weave setup"
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: Weave | set perms
|
|
|
|
file: path="{{ bin_dir }}/weave" mode=0755 state=file
|
|
|
|
|
|
|
|
- name: Weave | Set options
|
|
|
|
template:
|
|
|
|
src: weave.j2
|
|
|
|
dest: "/etc/weave.env"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify:
|
2016-07-30 20:03:41 +08:00
|
|
|
- restart weave
|
2016-02-10 00:16:16 +08:00
|
|
|
|
|
|
|
- name: Weave | Write weave systemd init file
|
|
|
|
template: src=weave.service.j2 dest=/etc/systemd/system/weave.service
|
2016-02-13 18:17:20 +08:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2016-07-30 20:03:41 +08:00
|
|
|
notify: restart weave
|
2016-02-10 00:16:16 +08:00
|
|
|
|
|
|
|
- name: Weave | Write weaveproxy systemd init file
|
|
|
|
template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service
|
2016-02-13 18:17:20 +08:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2016-07-30 20:03:41 +08:00
|
|
|
notify: restart weaveproxy
|
2016-02-10 00:16:16 +08:00
|
|
|
|
|
|
|
- name: Weave | Write weaveexpose systemd init file
|
|
|
|
template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service
|
2016-02-13 18:17:20 +08:00
|
|
|
when: ansible_service_mgr == "systemd"
|
2016-07-30 20:03:41 +08:00
|
|
|
notify: restart weaveexpose
|
|
|
|
|
|
|
|
- meta: flush_handlers
|
2016-02-10 00:16:16 +08:00
|
|
|
|
|
|
|
- name: Weave | Enable weave
|
|
|
|
service: name=weave enabled=yes state=started
|
|
|
|
|
|
|
|
- name: Weave | Enable weaveproxy
|
|
|
|
service: name=weaveproxy enabled=yes state=started
|
|
|
|
|
|
|
|
- name: Weave | Enable weaveexpose
|
|
|
|
service: name=weaveexpose enabled=yes state=started
|