2018-09-06 14:26:57 +00:00
|
|
|
---
|
2018-08-23 14:51:52 +00:00
|
|
|
- name: Create kubernetes directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2022-06-17 08:34:32 +00:00
|
|
|
owner: "{{ kube_owner }}"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0755
|
2021-04-29 12:20:50 +00:00
|
|
|
when: inventory_hostname in groups['k8s_cluster']
|
2018-08-23 14:51:52 +00:00
|
|
|
become: true
|
|
|
|
tags:
|
|
|
|
- kubelet
|
|
|
|
- k8s-secrets
|
|
|
|
- kube-controller-manager
|
|
|
|
- kube-apiserver
|
|
|
|
- bootstrap-os
|
|
|
|
- apps
|
|
|
|
- network
|
|
|
|
- master
|
|
|
|
- node
|
|
|
|
with_items:
|
|
|
|
- "{{ kube_config_dir }}"
|
2018-12-07 07:11:53 +00:00
|
|
|
- "{{ kube_cert_dir }}"
|
2018-08-23 14:51:52 +00:00
|
|
|
- "{{ kube_manifest_dir }}"
|
|
|
|
- "{{ kube_script_dir }}"
|
2019-07-30 19:00:10 +00:00
|
|
|
- "{{ kubelet_flexvolumes_plugins_dir }}"
|
2018-08-23 14:51:52 +00:00
|
|
|
|
2020-10-13 01:13:22 +00:00
|
|
|
- name: Create other directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0755
|
2021-04-29 12:20:50 +00:00
|
|
|
when: inventory_hostname in groups['k8s_cluster']
|
2020-10-13 01:13:22 +00:00
|
|
|
become: true
|
|
|
|
tags:
|
|
|
|
- kubelet
|
|
|
|
- k8s-secrets
|
|
|
|
- kube-controller-manager
|
|
|
|
- kube-apiserver
|
|
|
|
- bootstrap-os
|
|
|
|
- apps
|
|
|
|
- network
|
|
|
|
- master
|
|
|
|
- node
|
|
|
|
with_items:
|
|
|
|
- "{{ bin_dir }}"
|
|
|
|
|
2019-06-05 08:27:53 +00:00
|
|
|
- name: Check if kubernetes kubeadm compat cert dir exists
|
|
|
|
stat:
|
|
|
|
path: "{{ kube_cert_compat_dir }}"
|
2021-02-10 13:36:59 +00:00
|
|
|
get_attributes: no
|
|
|
|
get_checksum: no
|
|
|
|
get_mime: no
|
2019-06-05 08:27:53 +00:00
|
|
|
register: kube_cert_compat_dir_check
|
|
|
|
when:
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2019-06-05 08:27:53 +00:00
|
|
|
- kube_cert_dir != kube_cert_compat_dir
|
|
|
|
|
2019-04-19 13:01:54 +00:00
|
|
|
- name: Create kubernetes kubeadm compat cert dir (kubernetes/kubeadm issue 1498)
|
|
|
|
file:
|
|
|
|
src: "{{ kube_cert_dir }}"
|
|
|
|
dest: "{{ kube_cert_compat_dir }}"
|
|
|
|
state: link
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0755
|
2019-04-19 13:01:54 +00:00
|
|
|
when:
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2019-04-19 13:01:54 +00:00
|
|
|
- kube_cert_dir != kube_cert_compat_dir
|
2019-06-05 08:27:53 +00:00
|
|
|
- not kube_cert_compat_dir_check.stat.exists
|
2019-04-19 13:01:54 +00:00
|
|
|
|
2018-08-23 14:51:52 +00:00
|
|
|
- name: Create cni directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2022-06-17 08:34:32 +00:00
|
|
|
owner: "{{ kube_owner }}"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0755
|
2018-08-23 14:51:52 +00:00
|
|
|
with_items:
|
|
|
|
- "/etc/cni/net.d"
|
|
|
|
- "/opt/cni/bin"
|
|
|
|
- "/var/lib/calico"
|
|
|
|
when:
|
2021-12-03 19:56:35 +00:00
|
|
|
- kube_network_plugin in ["calico", "weave", "canal", "flannel", "cilium", "kube-ovn", "kube-router", "macvlan"]
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2018-08-23 14:51:52 +00:00
|
|
|
tags:
|
|
|
|
- network
|
|
|
|
- cilium
|
|
|
|
- calico
|
|
|
|
- weave
|
|
|
|
- canal
|
2019-07-31 03:10:20 +00:00
|
|
|
- kube-ovn
|
2018-10-16 14:15:05 +00:00
|
|
|
- kube-router
|
2018-08-23 14:51:52 +00:00
|
|
|
- bootstrap-os
|
|
|
|
|
|
|
|
- name: Create local volume provisioner directories
|
|
|
|
file:
|
2019-01-08 23:32:39 +00:00
|
|
|
path: "{{ local_volume_provisioner_storage_classes[item].host_dir }}"
|
2018-08-23 14:51:52 +00:00
|
|
|
state: directory
|
2018-10-05 12:52:25 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
2019-06-06 11:36:14 +00:00
|
|
|
mode: "{{ local_volume_provisioner_directory_mode }}"
|
2019-03-20 18:29:42 +00:00
|
|
|
with_items: "{{ local_volume_provisioner_storage_classes.keys() | list }}"
|
2018-08-23 14:51:52 +00:00
|
|
|
when:
|
2021-04-29 12:20:50 +00:00
|
|
|
- inventory_hostname in groups['k8s_cluster']
|
2018-08-23 14:51:52 +00:00
|
|
|
- local_volume_provisioner_enabled
|
|
|
|
tags:
|
|
|
|
- persistent_volumes
|