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.

67 lines
2.1 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. - import_tasks: encrypt-at-rest.yml
  13. when: kube_encrypt_secret_data
  14. - name: Compare host kubectl with hyperkube container
  15. command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubectl"
  16. register: kubectl_task_compare_result
  17. until: kubectl_task_compare_result.rc in [0,1,2]
  18. retries: 4
  19. delay: "{{ retry_stagger | random + 3 }}"
  20. changed_when: false
  21. failed_when: "kubectl_task_compare_result.rc not in [0,1,2]"
  22. tags:
  23. - hyperkube
  24. - kubectl
  25. - upgrade
  26. - name: Copy kubectl from hyperkube container
  27. command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl"
  28. when: kubectl_task_compare_result.rc != 0
  29. register: kubectl_task_result
  30. until: kubectl_task_result.rc == 0
  31. retries: 4
  32. delay: "{{ retry_stagger | random + 3 }}"
  33. changed_when: false
  34. tags:
  35. - hyperkube
  36. - kubectl
  37. - upgrade
  38. - name: Install kubectl bash completion
  39. shell: "{{ bin_dir }}/kubectl completion bash >/etc/bash_completion.d/kubectl.sh"
  40. when: kubectl_task_compare_result.rc != 0 and ansible_os_family in ["Debian","RedHat"]
  41. tags:
  42. - kubectl
  43. - name: Set kubectl bash completion file
  44. file:
  45. path: /etc/bash_completion.d/kubectl.sh
  46. owner: root
  47. group: root
  48. mode: 0755
  49. when: ansible_os_family in ["Debian","RedHat"]
  50. tags:
  51. - kubectl
  52. - upgrade
  53. - name: Include kubeadm setup if enabled
  54. import_tasks: kubeadm-setup.yml
  55. when: kubeadm_enabled|bool|default(false)
  56. - name: Include static pod setup if not using kubeadm
  57. import_tasks: static-pod-setup.yml
  58. when: not kubeadm_enabled|bool|default(false)