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.

64 lines
2.1 KiB

9 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. ---
  2. - include: pre-upgrade.yml
  3. - name: Copy kubectl from hyperkube container
  4. command: "/usr/bin/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl"
  5. register: kube_task_result
  6. until: kube_task_result.rc == 0
  7. retries: 4
  8. delay: "{{ retry_stagger | random + 3 }}"
  9. changed_when: false
  10. - name: Gather kubectl bash completion
  11. command: "{{ bin_dir }}/kubectl completion bash"
  12. no_log: true
  13. register: kubectl_bash_completion
  14. when: ansible_os_family in ["Debian","RedHat"]
  15. - name: Write kubectl bash completion
  16. copy:
  17. content: "{{ kubectl_bash_completion.stdout }}"
  18. dest: /etc/bash_completion.d/kubectl.sh
  19. owner: root
  20. group: root
  21. mode: 0755
  22. when: ansible_os_family in ["Debian","RedHat"] and kubectl_bash_completion.changed
  23. - name: Write kube-apiserver manifest
  24. template:
  25. src: manifests/kube-apiserver.manifest.j2
  26. dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
  27. notify: Master | wait for the apiserver to be running
  28. - meta: flush_handlers
  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. notify: Master | wait for kube-controller-manager
  50. - name: Write kube-scheduler manifest
  51. template:
  52. src: manifests/kube-scheduler.manifest.j2
  53. dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest"
  54. notify: Master | wait for kube-scheduler