You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.9 KiB

  1. ---
  2. # Required from inventory:
  3. # calico_rr_ip - which specific IP to use for RR, defaults to
  4. # "ip" from inventory or "ansible_default_ipv4.address"
  5. - name: Calico-rr | Set IP fact
  6. set_fact:
  7. rr_ip: "{{ calico_rr_ip | default(ip) | default(ansible_default_ipv4.address) }}"
  8. - name: Calico-rr | Create calico certs directory
  9. file:
  10. dest: "{{ calico_cert_dir }}"
  11. state: directory
  12. mode: 0750
  13. owner: root
  14. group: root
  15. - name: Calico-rr | Link etcd certificates for calico-node
  16. file:
  17. src: "{{ etcd_cert_dir }}/{{ item.s }}"
  18. dest: "{{ calico_cert_dir }}/{{ item.d }}"
  19. state: hard
  20. force: yes
  21. with_items:
  22. - {s: "ca.pem", d: "ca_cert.crt"}
  23. - {s: "node-{{ inventory_hostname }}.pem", d: "cert.crt"}
  24. - {s: "node-{{ inventory_hostname }}-key.pem", d: "key.pem"}
  25. - name: Calico-rr | Create dir for logs
  26. file:
  27. path: /var/log/calico-rr
  28. state: directory
  29. mode: 0755
  30. owner: root
  31. group: root
  32. - name: Calico-rr | Write calico-rr.env for systemd init file
  33. template:
  34. src: calico-rr.env.j2
  35. dest: /etc/calico/calico-rr.env
  36. notify: restart calico-rr
  37. - name: Calico-rr | Write calico-rr systemd init file
  38. template:
  39. src: calico-rr.service.j2
  40. dest: /etc/systemd/system/calico-rr.service
  41. notify: restart calico-rr
  42. - name: Calico-rr | Configure route reflector
  43. command: |-
  44. {{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} \
  45. set /calico/bgp/v1/rr_v4/{{ rr_ip }} \
  46. '{
  47. "ip": "{{ rr_ip }}",
  48. "cluster_id": "{{ cluster_id }}"
  49. }'
  50. retries: 4
  51. delay: "{{ retry_stagger | random + 3 }}"
  52. delegate_to: "{{groups['etcd'][0]}}"
  53. environment:
  54. ETCDCTL_CERT: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
  55. ETCDCTL_KEY: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"
  56. - meta: flush_handlers
  57. - name: Calico-rr | Enable calico-rr
  58. service:
  59. name: calico-rr
  60. state: started
  61. enabled: yes