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
|
|
|
|
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:
|
2019-05-03 05:24:21 +08:00
|
|
|
- "{{ bin_dir }}"
|
2018-08-23 22:51:52 +08:00
|
|
|
- "{{ kube_config_dir }}"
|
2018-12-07 15:11:53 +08:00
|
|
|
- "{{ kube_cert_dir }}"
|
2018-08-23 22:51:52 +08:00
|
|
|
- "{{ kube_manifest_dir }}"
|
|
|
|
- "{{ kube_script_dir }}"
|
2019-07-31 03:00:10 +08:00
|
|
|
- "{{ kubelet_flexvolumes_plugins_dir }}"
|
2018-08-23 22:51:52 +08:00
|
|
|
|
2019-06-05 16:27:53 +08:00
|
|
|
- name: Check if kubernetes kubeadm compat cert dir exists
|
|
|
|
stat:
|
|
|
|
path: "{{ kube_cert_compat_dir }}"
|
|
|
|
register: kube_cert_compat_dir_check
|
|
|
|
when:
|
|
|
|
- inventory_hostname in groups['k8s-cluster']
|
|
|
|
- kube_cert_dir != kube_cert_compat_dir
|
|
|
|
|
2019-04-19 21:01:54 +08:00
|
|
|
- name: Create kubernetes kubeadm compat cert dir (kubernetes/kubeadm issue 1498)
|
|
|
|
file:
|
|
|
|
src: "{{ kube_cert_dir }}"
|
|
|
|
dest: "{{ kube_cert_compat_dir }}"
|
|
|
|
state: link
|
|
|
|
when:
|
2019-04-22 06:27:43 +08:00
|
|
|
- inventory_hostname in groups['k8s-cluster']
|
2019-04-19 21:01:54 +08:00
|
|
|
- kube_cert_dir != kube_cert_compat_dir
|
2019-06-05 16:27:53 +08:00
|
|
|
- not kube_cert_compat_dir_check.stat.exists
|
2019-04-19 21:01:54 +08:00
|
|
|
|
2018-08-23 22:51:52 +08:00
|
|
|
- name: Create cni directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
with_items:
|
|
|
|
- "/etc/cni/net.d"
|
|
|
|
- "/opt/cni/bin"
|
|
|
|
- "/var/lib/calico"
|
|
|
|
when:
|
2020-07-31 22:33:08 +08:00
|
|
|
- kube_network_plugin in ["calico", "weave", "canal", "flannel", "contiv", "cilium", "kube-ovn", "ovn4nfv", "kube-router", "macvlan"]
|
2018-08-23 22:51:52 +08:00
|
|
|
- inventory_hostname in groups['k8s-cluster']
|
|
|
|
tags:
|
|
|
|
- network
|
|
|
|
- cilium
|
|
|
|
- calico
|
|
|
|
- weave
|
|
|
|
- canal
|
|
|
|
- contiv
|
2020-07-31 22:33:08 +08:00
|
|
|
- ovn4nfv
|
2019-07-31 11:10:20 +08:00
|
|
|
- kube-ovn
|
2018-10-16 22:15:05 +08:00
|
|
|
- kube-router
|
2018-08-23 22:51:52 +08:00
|
|
|
- bootstrap-os
|
|
|
|
|
|
|
|
- name: Create local volume provisioner directories
|
|
|
|
file:
|
2019-01-09 07:32:39 +08:00
|
|
|
path: "{{ local_volume_provisioner_storage_classes[item].host_dir }}"
|
2018-08-23 22:51:52 +08:00
|
|
|
state: directory
|
2018-10-05 20:52:25 +08:00
|
|
|
owner: root
|
|
|
|
group: root
|
2019-06-06 19:36:14 +08:00
|
|
|
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']
|
|
|
|
- local_volume_provisioner_enabled
|
|
|
|
tags:
|
|
|
|
- persistent_volumes
|