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.0 KiB

9 years ago
  1. ---
  2. - import_tasks: pre-upgrade.yml
  3. tags:
  4. - k8s-pre-upgrade
  5. # upstream bug: https://github.com/kubernetes/kubeadm/issues/441
  6. - name: Disable kube_basic_auth until kubeadm/441 is fixed
  7. set_fact:
  8. kube_basic_auth: false
  9. when: kubeadm_enabled|bool|default(false)
  10. - import_tasks: users-file.yml
  11. when: kube_basic_auth|default(true)
  12. - name: Compare host kubectl with hyperkube container
  13. command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubectl"
  14. register: kubectl_task_compare_result
  15. until: kubectl_task_compare_result.rc in [0,1,2]
  16. retries: 4
  17. delay: "{{ retry_stagger | random + 3 }}"
  18. changed_when: false
  19. failed_when: "kubectl_task_compare_result.rc not in [0,1,2]"
  20. tags:
  21. - hyperkube
  22. - kubectl
  23. - upgrade
  24. - name: Copy kubectl from hyperkube container
  25. command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl"
  26. when: kubectl_task_compare_result.rc != 0
  27. register: kubectl_task_result
  28. until: kubectl_task_result.rc == 0
  29. retries: 4
  30. delay: "{{ retry_stagger | random + 3 }}"
  31. changed_when: false
  32. tags:
  33. - hyperkube
  34. - kubectl
  35. - upgrade
  36. - name: Install kubectl bash completion
  37. shell: "{{ bin_dir }}/kubectl completion bash >/etc/bash_completion.d/kubectl.sh"
  38. when: kubectl_task_compare_result.rc != 0 and ansible_os_family in ["Debian","RedHat"]
  39. tags:
  40. - kubectl
  41. - name: Set kubectl bash completion file
  42. file:
  43. path: /etc/bash_completion.d/kubectl.sh
  44. owner: root
  45. group: root
  46. mode: 0755
  47. when: ansible_os_family in ["Debian","RedHat"]
  48. tags:
  49. - kubectl
  50. - upgrade
  51. - name: Include kubeadm setup if enabled
  52. import_tasks: kubeadm-setup.yml
  53. when: kubeadm_enabled|bool|default(false)
  54. - name: Include static pod setup if not using kubeadm
  55. import_tasks: static-pod-setup.yml
  56. when: not kubeadm_enabled|bool|default(false)