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.

103 lines
3.1 KiB

  1. ---
  2. - name: Kubernetes Apps | Wait for kube-apiserver
  3. uri:
  4. url: "{{ kube_apiserver_endpoint }}/healthz"
  5. validate_certs: no
  6. client_cert: "{{ kube_apiserver_client_cert }}"
  7. client_key: "{{ kube_apiserver_client_key }}"
  8. register: result
  9. until: result.status == 200
  10. retries: 10
  11. delay: 2
  12. when: inventory_hostname == groups['kube-master'][0]
  13. - name: Kubernetes Apps | Delete old kubedns resources
  14. kube:
  15. name: "kubedns"
  16. namespace: "{{ system_namespace }}"
  17. kubectl: "{{bin_dir}}/kubectl"
  18. resource: "{{ item }}"
  19. state: absent
  20. with_items:
  21. - 'deploy'
  22. - 'svc'
  23. tags:
  24. - upgrade
  25. - name: Kubernetes Apps | Delete kubeadm kubedns
  26. kube:
  27. name: "kubedns"
  28. namespace: "{{ system_namespace }}"
  29. kubectl: "{{bin_dir}}/kubectl"
  30. resource: "deploy"
  31. state: absent
  32. when:
  33. - kubeadm_enabled|default(false)
  34. - kubeadm_init.changed|default(false)
  35. - inventory_hostname == groups['kube-master'][0]
  36. - name: Kubernetes Apps | Lay Down KubeDNS Template
  37. template:
  38. src: "{{item.file}}"
  39. dest: "{{kube_config_dir}}/{{item.file}}"
  40. with_items:
  41. - {name: kube-dns, file: kubedns-sa.yml, type: sa}
  42. - {name: kube-dns, file: kubedns-deploy.yml.j2, type: deployment}
  43. - {name: kube-dns, file: kubedns-svc.yml, type: svc}
  44. - {name: kubedns-autoscaler, file: kubedns-autoscaler-sa.yml, type: sa}
  45. - {name: kubedns-autoscaler, file: kubedns-autoscaler-clusterrole.yml, type: clusterrole}
  46. - {name: kubedns-autoscaler, file: kubedns-autoscaler-clusterrolebinding.yml, type: clusterrolebinding}
  47. - {name: kubedns-autoscaler, file: kubedns-autoscaler.yml.j2, type: deployment}
  48. register: manifests
  49. when:
  50. - dns_mode != 'none' and inventory_hostname == groups['kube-master'][0]
  51. - rbac_enabled or item.type not in rbac_resources
  52. tags:
  53. - dnsmasq
  54. # see https://github.com/kubernetes/kubernetes/issues/45084, only needed for "old" kube-dns
  55. - name: Kubernetes Apps | Patch system:kube-dns ClusterRole
  56. command: >
  57. {{bin_dir}}/kubectl patch clusterrole system:kube-dns
  58. --patch='{
  59. "rules": [
  60. {
  61. "apiGroups" : [""],
  62. "resources" : ["endpoints", "services"],
  63. "verbs": ["list", "watch", "get"]
  64. }
  65. ]
  66. }'
  67. when:
  68. - dns_mode != 'none' and inventory_hostname == groups['kube-master'][0]
  69. - rbac_enabled and kubedns_version|version_compare("1.11.0", "<", strict=True)
  70. tags:
  71. - dnsmasq
  72. - name: Kubernetes Apps | Start Resources
  73. kube:
  74. name: "{{item.item.name}}"
  75. namespace: "{{ system_namespace }}"
  76. kubectl: "{{bin_dir}}/kubectl"
  77. resource: "{{item.item.type}}"
  78. filename: "{{kube_config_dir}}/{{item.item.file}}"
  79. state: "latest"
  80. with_items: "{{ manifests.results }}"
  81. when:
  82. - dns_mode != 'none'
  83. - inventory_hostname == groups['kube-master'][0]
  84. - not item|skipped
  85. tags:
  86. - dnsmasq
  87. - name: Kubernetes Apps | Netchecker
  88. import_tasks: tasks/netchecker.yml
  89. when: deploy_netchecker
  90. tags:
  91. - netchecker
  92. - name: Kubernetes Apps | Dashboard
  93. import_tasks: tasks/dashboard.yml
  94. when: dashboard_enabled
  95. tags:
  96. - dashboard