Skip to content
calico.yml 1.33 KiB
Newer Older
Smaine Kahlouch's avatar
Smaine Kahlouch committed
---
- name: Calico | Install calicoctl bin
ant31's avatar
ant31 committed
  copy:
Smaine Kahlouch's avatar
Smaine Kahlouch committed
     src={{ local_release_dir }}/calico/bin/calicoctl
     dest={{ bin_dir }}
     mode=u+x
  notify: restart calico-node

- name: Calico | Create calicoctl symlink (needed by kubelet)
Smaine Kahlouch's avatar
Smaine Kahlouch committed
  file: src=/usr/local/bin/calicoctl dest=/usr/bin/calicoctl state=link

- name: Calico | Configure calico-node desired pool
  shell: calicoctl pool add {{ kube_pods_subnet }}
  environment:
     ETCD_AUTHORITY: "{{ loadbalancer_address | default(groups['kube-master'][0]) }}:2379"
- name: Calico | Write calico-node systemd init file
Smaine Kahlouch's avatar
Smaine Kahlouch committed
  template: src=calico/calico-node.service.j2 dest=/etc/systemd/system/calico-node.service
ant31's avatar
ant31 committed
  register: newservice
  notify:
Smaine Kahlouch's avatar
Smaine Kahlouch committed
    - reload systemd
    - restart calico-node

ant31's avatar
ant31 committed
- name: Calico | daemon-reload
  command: systemctl daemon-reload
  when: newservice|changed
  changed_when: False

- name: Calico | Enable calico-node
Smaine Kahlouch's avatar
Smaine Kahlouch committed
  service: name=calico-node enabled=yes state=started

- name: Calico | Disable node mesh
  shell: calicoctl bgp node-mesh off
  when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']

- name: Calico | Configure peering with router(s)
  shell: calicoctl node bgp peer add {{ item.router_id }} as {{ item.as }}
  with_items: peers
  when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']