2017-11-01 22:25:35 +08:00
|
|
|
---
|
2020-07-07 23:09:59 +08:00
|
|
|
|
2017-11-01 22:25:35 +08:00
|
|
|
- name: Local Volume Provisioner | Ensure base dir is created on all hosts
|
2020-07-07 23:09:59 +08:00
|
|
|
include_tasks: basedirs.yml
|
|
|
|
loop_control:
|
|
|
|
loop_var: delegate_host_base_dir
|
2021-04-29 20:20:50 +08:00
|
|
|
loop: "{{ groups['k8s_cluster'] | product(local_volume_provisioner_storage_classes.keys()) | list }}"
|
2017-11-01 22:25:35 +08:00
|
|
|
|
|
|
|
- name: Local Volume Provisioner | Create addon dir
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/local_volume_provisioner"
|
2018-02-15 09:55:43 +08:00
|
|
|
state: directory
|
2017-11-01 22:25:35 +08:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
|
2018-08-23 00:16:13 +08:00
|
|
|
- name: Local Volume Provisioner | Templates list
|
|
|
|
set_fact:
|
|
|
|
local_volume_provisioner_templates:
|
|
|
|
- { name: local-volume-provisioner-ns, file: local-volume-provisioner-ns.yml, type: ns }
|
|
|
|
- { name: local-volume-provisioner-sa, file: local-volume-provisioner-sa.yml, type: sa }
|
2019-07-16 20:27:26 +08:00
|
|
|
- { name: local-volume-provisioner-clusterrole, file: local-volume-provisioner-clusterrole.yml, type: clusterrole }
|
2018-08-23 00:16:13 +08:00
|
|
|
- { name: local-volume-provisioner-clusterrolebinding, file: local-volume-provisioner-clusterrolebinding.yml, type: clusterrolebinding }
|
|
|
|
- { name: local-volume-provisioner-cm, file: local-volume-provisioner-cm.yml, type: cm }
|
|
|
|
- { name: local-volume-provisioner-ds, file: local-volume-provisioner-ds.yml, type: ds }
|
|
|
|
- { name: local-volume-provisioner-sc, file: local-volume-provisioner-sc.yml, type: sc }
|
|
|
|
|
2017-11-01 22:25:35 +08:00
|
|
|
- name: Local Volume Provisioner | Create manifests
|
|
|
|
template:
|
2018-02-01 14:14:18 +08:00
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.file }}"
|
2022-01-09 17:51:12 +08:00
|
|
|
mode: 0644
|
2018-08-23 00:16:13 +08:00
|
|
|
with_items: "{{ local_volume_provisioner_templates }}"
|
2018-02-15 09:55:43 +08:00
|
|
|
register: local_volume_provisioner_manifests
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2017-11-01 22:25:35 +08:00
|
|
|
|
|
|
|
- name: Local Volume Provisioner | Apply manifests
|
|
|
|
kube:
|
2019-04-24 01:37:23 +08:00
|
|
|
name: "{{ item.item.name }}"
|
2018-02-15 09:55:43 +08:00
|
|
|
namespace: "{{ local_volume_provisioner_namespace }}"
|
2018-02-01 14:14:18 +08:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2019-04-24 01:37:23 +08:00
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.item.file }}"
|
2017-11-01 22:25:35 +08:00
|
|
|
state: "latest"
|
2019-04-24 01:37:23 +08:00
|
|
|
with_items: "{{ local_volume_provisioner_manifests.results }}"
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2019-04-24 01:37:23 +08:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.item.file }}"
|