kubespray/roles/kubernetes/preinstall/tasks/0050-create_directories.yml

120 lines
2.8 KiB
YAML
Raw Normal View History

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