2015-10-04 04:19:50 +08:00
|
|
|
---
|
2016-11-09 18:44:41 +08:00
|
|
|
- name: Flannel | Set Flannel etcd configuration
|
|
|
|
command: |-
|
|
|
|
{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \
|
|
|
|
set /{{ cluster_name }}/network/config \
|
|
|
|
'{ "Network": "{{ kube_pods_subnet }}", "SubnetLen": {{ kube_network_node_prefix }}, "Backend": { "Type": "{{ flannel_backend_type }}" } }'
|
|
|
|
delegate_to: "{{groups['etcd'][0]}}"
|
|
|
|
run_once: true
|
2016-05-09 12:42:42 +08:00
|
|
|
|
2016-01-09 17:45:50 +08:00
|
|
|
- name: Flannel | Create flannel pod manifest
|
2015-10-04 04:19:50 +08:00
|
|
|
template:
|
2016-01-30 23:04:47 +08:00
|
|
|
src: flannel-pod.yml
|
2016-01-09 17:45:50 +08:00
|
|
|
dest: /etc/kubernetes/manifests/flannel-pod.manifest
|
|
|
|
notify: delete default docker bridge
|
|
|
|
|
|
|
|
- name: Flannel | Wait for flannel subnet.env file presence
|
|
|
|
wait_for:
|
|
|
|
path: /run/flannel/subnet.env
|
|
|
|
delay: 5
|
2016-02-20 01:48:53 +08:00
|
|
|
timeout: 600
|
2016-01-09 17:45:50 +08:00
|
|
|
|
2016-01-30 23:04:47 +08:00
|
|
|
- name: Flannel | Get flannel_subnet from subnet.env
|
2016-01-09 17:45:50 +08:00
|
|
|
shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_SUBNET" {print $2}'
|
|
|
|
register: flannel_subnet_output
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
flannel_subnet: "{{ flannel_subnet_output.stdout }}"
|
|
|
|
|
2016-01-30 23:04:47 +08:00
|
|
|
- name: Flannel | Get flannel_mtu from subnet.env
|
2016-01-09 17:45:50 +08:00
|
|
|
shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_MTU" {print $2}'
|
|
|
|
register: flannel_mtu_output
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
flannel_mtu: "{{ flannel_mtu_output.stdout }}"
|
2016-01-30 23:04:47 +08:00
|
|
|
|
|
|
|
- name: Flannel | Set docker daemon options
|
|
|
|
template:
|
|
|
|
src: docker
|
|
|
|
dest: "/etc/default/docker"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify:
|
|
|
|
- restart docker
|
2016-08-31 00:17:41 +08:00
|
|
|
when: ansible_os_family != "CoreOS"
|
2016-01-30 23:04:47 +08:00
|
|
|
|
2016-08-31 00:34:34 +08:00
|
|
|
- name: Flannel | Create docker service path for CoreOS
|
|
|
|
file: path=/etc/systemd/system/docker.service.d state=directory
|
|
|
|
when: ansible_os_family == "CoreOS"
|
|
|
|
|
2016-08-31 00:17:41 +08:00
|
|
|
- name: Flannel | Create docker dropin for CoreOS
|
|
|
|
template:
|
2016-08-31 00:26:14 +08:00
|
|
|
src: docker-systemd
|
2016-08-31 00:17:41 +08:00
|
|
|
dest: "/etc/systemd/system/docker.service.d/flannel-options.conf"
|
|
|
|
notify:
|
|
|
|
- restart docker
|
2016-02-20 01:48:53 +08:00
|
|
|
when: ansible_os_family == "CoreOS"
|
|
|
|
|
2016-01-30 23:04:47 +08:00
|
|
|
- meta: flush_handlers
|