2015-10-04 04:19:50 +08:00
|
|
|
---
|
2015-10-15 15:40:02 +08:00
|
|
|
- name: Calico | Install calicoctl bin
|
2015-11-20 21:04:13 +08:00
|
|
|
copy:
|
2015-10-04 04:19:50 +08:00
|
|
|
src={{ local_release_dir }}/calico/bin/calicoctl
|
|
|
|
dest={{ bin_dir }}
|
2015-12-18 05:46:50 +08:00
|
|
|
mode=0755
|
2015-10-04 04:19:50 +08:00
|
|
|
notify: restart calico-node
|
|
|
|
|
2015-10-15 15:40:02 +08:00
|
|
|
- name: Calico | Create calicoctl symlink (needed by kubelet)
|
2015-10-04 04:19:50 +08:00
|
|
|
file: src=/usr/local/bin/calicoctl dest=/usr/bin/calicoctl state=link
|
|
|
|
|
2015-12-11 18:42:25 +08:00
|
|
|
- name: Calico | Configure calico-node desired pool
|
|
|
|
shell: calicoctl pool add {{ kube_pods_subnet }}
|
|
|
|
environment:
|
2015-12-15 18:49:11 +08:00
|
|
|
ETCD_AUTHORITY: "{{ groups['etcd'][0] }}:2379"
|
2015-12-11 18:42:25 +08:00
|
|
|
run_once: true
|
2015-12-18 17:16:03 +08:00
|
|
|
delegate_to: "{{ groups['etcd'][0] }}"
|
2015-12-11 18:42:25 +08:00
|
|
|
|
2015-10-15 15:40:02 +08:00
|
|
|
- name: Calico | Write calico-node systemd init file
|
2015-10-04 04:19:50 +08:00
|
|
|
template: src=calico/calico-node.service.j2 dest=/etc/systemd/system/calico-node.service
|
2015-11-20 21:04:13 +08:00
|
|
|
register: newservice
|
|
|
|
notify:
|
2015-10-04 04:19:50 +08:00
|
|
|
- reload systemd
|
|
|
|
- restart calico-node
|
|
|
|
|
2015-11-20 21:04:13 +08:00
|
|
|
- name: Calico | daemon-reload
|
|
|
|
command: systemctl daemon-reload
|
|
|
|
when: newservice|changed
|
|
|
|
changed_when: False
|
|
|
|
|
2015-10-15 15:40:02 +08:00
|
|
|
- name: Calico | Enable calico-node
|
2015-10-04 04:19:50 +08:00
|
|
|
service: name=calico-node enabled=yes state=started
|
|
|
|
|
2015-10-15 15:40:02 +08:00
|
|
|
- name: Calico | Disable node mesh
|
|
|
|
shell: calicoctl bgp node-mesh off
|
2015-11-02 20:41:03 +08:00
|
|
|
when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']
|
2015-10-15 15:40:02 +08:00
|
|
|
|
|
|
|
- name: Calico | Configure peering with router(s)
|
|
|
|
shell: calicoctl node bgp peer add {{ item.router_id }} as {{ item.as }}
|
|
|
|
with_items: peers
|
2015-11-02 20:41:03 +08:00
|
|
|
when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']
|