main.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---
  2. - include: ../../../roles/etcd_client_certificates/tasks/main.yml
  3. vars:
  4. etcd_cert_prefix: calico.etcd-
  5. etcd_cert_config_dir: "{{ openshift.common.config_base }}/calico"
  6. embedded_etcd: "{{ hostvars[groups.oo_first_master.0].openshift.master.embedded_etcd }}"
  7. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  8. etcd_cert_subdir: "openshift-calico-{{ openshift.common.hostname }}"
  9. - name: Calico Node | Assure the calico certs have been generated
  10. stat:
  11. path: "{{ item }}"
  12. with_items:
  13. - "{{ calico_etcd_ca_cert_file }}"
  14. - "{{ calico_etcd_cert_file}}"
  15. - "{{ calico_etcd_key_file }}"
  16. - name: Calico Node | Configure Calico service unit file
  17. template:
  18. dest: "/lib/systemd/system/calico.service"
  19. src: calico.service.j2
  20. - name: Calico Node | Enable calico
  21. become: yes
  22. systemd:
  23. name: calico
  24. daemon_reload: yes
  25. state: started
  26. enabled: yes
  27. register: start_result
  28. - name: Calico Node | Assure CNI conf dir exists
  29. become: yes
  30. file: path="{{ cni_conf_dir }}" state=directory
  31. - name: Calico Node | Generate Calico CNI config
  32. become: yes
  33. template:
  34. src: "10-calico.conf.j2"
  35. dest: "{{ cni_conf_dir }}/10-calico.conf"
  36. - name: Calico Node | Assures Kuberentes CNI bin dir exists
  37. become: yes
  38. file: path="{{ cni_bin_dir }}" state=directory
  39. - name: Calico Node | Download Calico CNI Plugin
  40. become: yes
  41. get_url:
  42. url: "{{ calico_url_cni }}"
  43. dest: "{{ cni_bin_dir }}"
  44. mode: a+x
  45. - name: Calico Node | Download Calico IPAM Plugin
  46. become: yes
  47. get_url:
  48. url: "{{ calico_url_ipam }}"
  49. dest: "{{ cni_bin_dir }}"
  50. mode: a+x
  51. - name: Calico Node | Download and extract standard CNI plugins
  52. become: yes
  53. unarchive:
  54. remote_src: True
  55. src: "{{ cni_url }}"
  56. dest: "{{ cni_bin_dir }}"
  57. - name: Calico Node | Assure Calico conf dir exists
  58. become: yes
  59. file: path=/etc/calico/ state=directory
  60. - name: Calico Node | Set calicoctl.cfg
  61. template:
  62. src: calicoctl.cfg.j2
  63. dest: "/etc/calico/calicoctl.cfg"