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.

100 lines
2.4 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. ---
  2. - name: Create kubernetes directories
  3. file:
  4. path: "{{ item }}"
  5. state: directory
  6. owner: kube
  7. when: inventory_hostname in groups['k8s-cluster']
  8. become: true
  9. tags:
  10. - kubelet
  11. - k8s-secrets
  12. - kube-controller-manager
  13. - kube-apiserver
  14. - bootstrap-os
  15. - apps
  16. - network
  17. - master
  18. - node
  19. with_items:
  20. - "{{ kube_config_dir }}"
  21. - "{{ kube_cert_dir }}"
  22. - "{{ kube_manifest_dir }}"
  23. - "{{ kube_script_dir }}"
  24. - "{{ kubelet_flexvolumes_plugins_dir }}"
  25. - name: Create other directories
  26. file:
  27. path: "{{ item }}"
  28. state: directory
  29. owner: root
  30. when: inventory_hostname in groups['k8s-cluster']
  31. become: true
  32. tags:
  33. - kubelet
  34. - k8s-secrets
  35. - kube-controller-manager
  36. - kube-apiserver
  37. - bootstrap-os
  38. - apps
  39. - network
  40. - master
  41. - node
  42. with_items:
  43. - "{{ bin_dir }}"
  44. - name: Check if kubernetes kubeadm compat cert dir exists
  45. stat:
  46. path: "{{ kube_cert_compat_dir }}"
  47. register: kube_cert_compat_dir_check
  48. when:
  49. - inventory_hostname in groups['k8s-cluster']
  50. - kube_cert_dir != kube_cert_compat_dir
  51. - name: Create kubernetes kubeadm compat cert dir (kubernetes/kubeadm issue 1498)
  52. file:
  53. src: "{{ kube_cert_dir }}"
  54. dest: "{{ kube_cert_compat_dir }}"
  55. state: link
  56. when:
  57. - inventory_hostname in groups['k8s-cluster']
  58. - kube_cert_dir != kube_cert_compat_dir
  59. - not kube_cert_compat_dir_check.stat.exists
  60. - name: Create cni directories
  61. file:
  62. path: "{{ item }}"
  63. state: directory
  64. owner: kube
  65. with_items:
  66. - "/etc/cni/net.d"
  67. - "/opt/cni/bin"
  68. - "/var/lib/calico"
  69. when:
  70. - kube_network_plugin in ["calico", "weave", "canal", "flannel", "contiv", "cilium", "kube-ovn", "ovn4nfv", "kube-router", "macvlan"]
  71. - inventory_hostname in groups['k8s-cluster']
  72. tags:
  73. - network
  74. - cilium
  75. - calico
  76. - weave
  77. - canal
  78. - contiv
  79. - ovn4nfv
  80. - kube-ovn
  81. - kube-router
  82. - bootstrap-os
  83. - name: Create local volume provisioner directories
  84. file:
  85. path: "{{ local_volume_provisioner_storage_classes[item].host_dir }}"
  86. state: directory
  87. owner: root
  88. group: root
  89. mode: "{{ local_volume_provisioner_directory_mode }}"
  90. with_items: "{{ local_volume_provisioner_storage_classes.keys() | list }}"
  91. when:
  92. - inventory_hostname in groups['k8s-cluster']
  93. - local_volume_provisioner_enabled
  94. tags:
  95. - persistent_volumes