kubespray/roles/kubernetes-apps/local_volume_provisioner/tasks/main.yml

43 lines
1.4 KiB
YAML

---
- name: Local Volume Provisioner | Ensure base dir is created on all hosts
file:
path: "{{ local_volume_base_dir }}"
ensure: directory
owner: root
group: root
mode: 0700
delegate_to: "{{ item }}"
with_items: "{{ groups['k8s-cluster'] }}"
failed_when: false
- name: Local Volume Provisioner | Create addon dir
file:
path: "{{ kube_config_dir }}/addons/local_volume_provisioner"
owner: root
group: root
mode: 0755
recurse: true
- name: Local Volume Provisioner | Create manifests
template:
src: "{{item.file}}.j2"
dest: "{{kube_config_dir}}/addons/local_volume_provisioner/{{item.file}}"
with_items:
- {name: local-storage-provisioner-pv-binding, file: provisioner-admin-account.yml, type: clusterrolebinding}
- {name: local-volume-config, file: volume-config.yml, type: configmap}
- {name: local-volume-provisioner, file: provisioner-ds.yml, type: daemonset}
register: local_volume_manifests
when: inventory_hostname == groups['kube-master'][0]
- name: Local Volume Provisioner | Apply manifests
kube:
name: "{{item.item.name}}"
namespace: "{{ system_namespace }}"
kubectl: "{{bin_dir}}/kubectl"
resource: "{{item.item.type}}"
filename: "{{kube_config_dir}}/addons/local_volume_provisioner/{{item.item.file}}"
state: "latest"
with_items: "{{ local_volume_manifests.results }}"
when: inventory_hostname == groups['kube-master'][0]