2015-10-03 20:19:50 +00:00
|
|
|
---
|
|
|
|
- name: Create flannel user
|
|
|
|
user: name=flannel shell=/bin/nologin
|
|
|
|
|
|
|
|
- name: Install flannel binaries
|
2016-01-04 13:58:27 +00:00
|
|
|
synchronize:
|
|
|
|
src: "{{ local_release_dir }}/flannel/bin/flanneld"
|
|
|
|
dest: "{{ bin_dir }}/flanneld"
|
|
|
|
archive: no
|
|
|
|
times: yes
|
|
|
|
delegate_to: "{{ groups['downloader'][0] }}"
|
2015-10-03 20:19:50 +00:00
|
|
|
notify:
|
|
|
|
- restart flannel
|
|
|
|
|
2016-01-04 13:58:27 +00:00
|
|
|
- name: Perms flannel binary
|
|
|
|
file: path={{ bin_dir }}/flanneld owner=flannel mode=0755 state=file
|
|
|
|
|
2015-10-03 20:19:50 +00:00
|
|
|
- name: Write flannel.service systemd file
|
|
|
|
template:
|
|
|
|
src: flannel/systemd-flannel.service.j2
|
|
|
|
dest: /etc/systemd/system/flannel.service
|
|
|
|
notify: restart flannel
|
|
|
|
|
|
|
|
- name: Write docker.service systemd file
|
|
|
|
template:
|
|
|
|
src: flannel/systemd-docker.service.j2
|
|
|
|
dest: /lib/systemd/system/docker.service
|
|
|
|
notify: restart docker
|
|
|
|
|
|
|
|
- name: Set fact for ectcd command conf file location
|
|
|
|
set_fact:
|
|
|
|
conf_file: "/tmp/flannel-conf.json"
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
|
|
|
|
- name: Create flannel config file to go in etcd
|
|
|
|
template: src=flannel/flannel-conf.json.j2 dest={{ conf_file }}
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
|
|
|
|
- name: Flannel configuration into etcd
|
|
|
|
shell: "{{ bin_dir }}/etcdctl set /{{ cluster_name }}/network/config < {{ conf_file }}"
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
notify: restart flannel
|
|
|
|
|
|
|
|
- name: Clean up the flannel config file
|
|
|
|
file: path=/tmp/flannel-config.json state=absent
|
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
|
|
|
|
|
|
|
- name: Launch Flannel
|
|
|
|
service: name=flannel state=started enabled=yes
|
|
|
|
notify:
|
|
|
|
- restart flannel
|
|
|
|
|
|
|
|
- name: Enable Docker
|
|
|
|
service: name=docker enabled=yes state=started
|