k8s_calico.yaml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---
  2. # cybergavin
  3. # Install Calico with Tigera operator - https://docs.projectcalico.org/getting-started/kubernetes/quickstart
  4. - name: Create .kube directory
  5. file:
  6. path: /root/.kube
  7. state: directory
  8. - name: Copy kubernetes config file for kubectl
  9. copy:
  10. src: /etc/kubernetes/admin.conf
  11. remote_src: yes
  12. dest: /root/.kube/config
  13. - name: Include variables
  14. include_vars: dir=vars
  15. - name: Install the Tigera Operator
  16. command: kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
  17. register: tigera_operator_install
  18. failed_when: tigera_operator_install.rc != 0
  19. - name: Copy calico manifest file
  20. copy:
  21. src: "{{ playbook_dir }}/files/calico-base.yaml"
  22. dest: /root/calico-base.yaml
  23. - name: Set pod network CIDR in Calico manifest
  24. replace:
  25. path: /root/calico-base.yaml
  26. regexp: 'POD_NETWORK'
  27. replace: "{{ pod_network }}"
  28. - name: Install Calico
  29. command: kubectl create -f /root/calico-base.yaml
  30. register: calico_install
  31. failed_when: calico_install.rc != 0