2017-11-01 14:25:35 +00:00
|
|
|
---
|
|
|
|
- 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:
|
2018-02-01 06:14:18 +00:00
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.file }}"
|
2017-11-01 14:25:35 +00:00
|
|
|
with_items:
|
2018-02-01 06:14:18 +00:00
|
|
|
- { 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 }
|
2017-11-01 14:25:35 +00:00
|
|
|
register: local_volume_manifests
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
|
|
|
|
|
|
|
- name: Local Volume Provisioner | Apply manifests
|
|
|
|
kube:
|
2018-02-01 06:14:18 +00:00
|
|
|
name: "{{ item.item.name }}"
|
2017-11-01 14:25:35 +00:00
|
|
|
namespace: "{{ system_namespace }}"
|
2018-02-01 06:14:18 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.item.file }}"
|
2017-11-01 14:25:35 +00:00
|
|
|
state: "latest"
|
|
|
|
with_items: "{{ local_volume_manifests.results }}"
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|