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.

65 lines
1.9 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. ---
  2. - include: pre-upgrade.yml
  3. - name: Copy kubectl bash completion
  4. copy:
  5. src: kubectl_bash_completion.sh
  6. dest: /etc/bash_completion.d/kubectl.sh
  7. when: ansible_os_family in ["Debian","RedHat"]
  8. - name: Copy kubectl from hyperkube container
  9. command: "/usr/bin/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl"
  10. changed_when: false
  11. register: kubectl_launcher
  12. - meta: flush_handlers
  13. - name: Write kube-apiserver manifest
  14. template:
  15. src: manifests/kube-apiserver.manifest.j2
  16. dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
  17. register: apiserver_manifest
  18. - name: restart kubelet
  19. service:
  20. name: kubelet
  21. state: restarted
  22. when: apiserver_manifest.changed
  23. - name: wait for the apiserver to be running
  24. uri: url=http://localhost:8080/healthz
  25. register: result
  26. until: result.status == 200
  27. retries: 10
  28. delay: 6
  29. # Create kube-system namespace
  30. - name: copy 'kube-system' namespace manifest
  31. copy: src=namespace.yml dest=/etc/kubernetes/kube-system-ns.yml
  32. run_once: yes
  33. when: inventory_hostname == groups['kube-master'][0]
  34. - name: Check if kube-system exists
  35. command: "{{ bin_dir }}/kubectl get ns kube-system"
  36. register: 'kubesystem'
  37. changed_when: False
  38. failed_when: False
  39. run_once: yes
  40. - name: Create 'kube-system' namespace
  41. command: "{{ bin_dir }}/kubectl create -f /etc/kubernetes/kube-system-ns.yml"
  42. changed_when: False
  43. when: kubesystem|failed and inventory_hostname == groups['kube-master'][0]
  44. # Write other manifests
  45. - name: Write kube-controller-manager manifest
  46. template:
  47. src: manifests/kube-controller-manager.manifest.j2
  48. dest: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
  49. - name: Write kube-scheduler manifest
  50. template:
  51. src: manifests/kube-scheduler.manifest.j2
  52. dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest"