c12s-kubespray/roles/kubernetes-apps/local_volume_provisioner/tasks/main.yml
2018-02-01 14:14:18 +08:00

43 lines
1.5 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-volume-serviceaccount, file: serviceaccount.yml, type, serviceaccount }
- { name: local-volume-clusterrolebinding, file: clusterrolebinding.yml, type, clusterrolebinding }
- { name: local-volume-configmap, file: configmap.yml, type, configmap }
- { name: local-volume-daemonset, file: daemonset.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]