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.

70 lines
2.2 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. #no_log: true
  15. when: ansible_os_family in ["Debian","RedHat"]
  16. tags: kubectl
  17. - name: Set kubectl bash completion file
  18. file:
  19. path: /etc/bash_completion.d/kubectl.sh
  20. owner: root
  21. group: root
  22. mode: 0755
  23. when: ansible_os_family in ["Debian","RedHat"]
  24. tags: [kubectl, upgrade]
  25. - name: Write kube-apiserver manifest
  26. template:
  27. src: manifests/kube-apiserver.manifest.j2
  28. dest: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
  29. notify: Master | wait for the apiserver to be running
  30. tags: kube-apiserver
  31. - meta: flush_handlers
  32. - name: copy kube system namespace manifest
  33. copy: src=namespace.yml dest={{kube_config_dir}}/{{system_namespace}}-ns.yml
  34. run_once: yes
  35. when: inventory_hostname == groups['kube-master'][0]
  36. tags: apps
  37. - name: Check if kube system namespace exists
  38. command: "{{ bin_dir }}/kubectl get ns {{system_namespace}}"
  39. register: 'kubesystem'
  40. changed_when: False
  41. failed_when: False
  42. run_once: yes
  43. tags: apps
  44. - name: Create kube system namespace
  45. command: "{{ bin_dir }}/kubectl create -f {{kube_config_dir}}/{{system_namespace}}-ns.yml"
  46. changed_when: False
  47. when: kubesystem|failed and inventory_hostname == groups['kube-master'][0]
  48. tags: apps
  49. - name: Write kube-controller-manager manifest
  50. template:
  51. src: manifests/kube-controller-manager.manifest.j2
  52. dest: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
  53. notify: Master | wait for kube-controller-manager
  54. tags: kube-controller-manager
  55. - name: Write kube-scheduler manifest
  56. template:
  57. src: manifests/kube-scheduler.manifest.j2
  58. dest: "{{ kube_manifest_dir }}/kube-scheduler.manifest"
  59. notify: Master | wait for kube-scheduler
  60. tags: kube-scheduler