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.

79 lines
2.4 KiB

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. tags: k8s-pre-upgrade
  4. - name: Copy kubectl from hyperkube container
  5. command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl"
  6. register: kube_task_result
  7. until: kube_task_result.rc == 0
  8. retries: 4
  9. delay: "{{ retry_stagger | random + 3 }}"
  10. changed_when: false
  11. tags: [hyperkube, kubectl, upgrade]
  12. - name: Install kubectl bash completion
  13. shell: "{{ bin_dir }}/kubectl completion bash >/etc/bash_completion.d/kubectl.sh"
  14. when: ansible_os_family in ["Debian","RedHat"]
  15. tags: kubectl
  16. - name: Set kubectl bash completion file
  17. file:
  18. path: /etc/bash_completion.d/kubectl.sh
  19. owner: root
  20. group: root
  21. mode: 0755
  22. when: ansible_os_family in ["Debian","RedHat"]
  23. tags: [kubectl, upgrade]
  24. - name: Write kube-apiserver manifest
  25. template:
  26. src: manifests/kube-apiserver.manifest.j2
  27. dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
  28. notify: Master | wait for the apiserver to be running
  29. tags: kube-apiserver
  30. - meta: flush_handlers
  31. - name: copy kube system namespace manifest
  32. copy:
  33. src: namespace.yml
  34. dest: "{{kube_config_dir}}/{{system_namespace}}-ns.yml"
  35. run_once: yes
  36. when: inventory_hostname == groups['kube-master'][0]
  37. tags: apps
  38. - name: Check if kube system namespace exists
  39. command: "{{ bin_dir }}/kubectl get ns {{system_namespace}}"
  40. register: 'kubesystem'
  41. changed_when: False
  42. failed_when: False
  43. run_once: yes
  44. tags: apps
  45. - name: Create kube system namespace
  46. command: "{{ bin_dir }}/kubectl create -f {{kube_config_dir}}/{{system_namespace}}-ns.yml"
  47. retries: 4
  48. delay: "{{ retry_stagger | random + 3 }}"
  49. register: create_system_ns
  50. until: create_system_ns.rc == 0
  51. changed_when: False
  52. when: kubesystem|failed and inventory_hostname == groups['kube-master'][0]
  53. tags: apps
  54. - name: Write kube-controller-manager manifest
  55. template:
  56. src: manifests/kube-controller-manager.manifest.j2
  57. dest: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
  58. notify: Master | wait for kube-controller-manager
  59. tags: kube-controller-manager
  60. - name: Write kube-scheduler manifest
  61. template:
  62. src: manifests/kube-scheduler.manifest.j2
  63. dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest"
  64. notify: Master | wait for kube-scheduler
  65. tags: kube-scheduler
  66. - include: post-upgrade.yml
  67. tags: k8s-post-upgrade