2018-08-08 20:22:50 +08:00
|
|
|
---
|
|
|
|
- name: "Kubernetes Apps | Lay Down Heketi"
|
|
|
|
become: true
|
2019-05-16 15:27:43 +08:00
|
|
|
template:
|
|
|
|
src: "heketi-deployment.json.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/heketi-deployment.json"
|
2021-07-12 15:00:47 +08:00
|
|
|
mode: 0644
|
2018-08-08 20:22:50 +08:00
|
|
|
register: "rendering"
|
2019-05-16 15:27:43 +08:00
|
|
|
|
2018-08-08 20:22:50 +08:00
|
|
|
- name: "Kubernetes Apps | Install and configure Heketi"
|
|
|
|
kube:
|
|
|
|
name: "GlusterFS"
|
2019-05-03 05:24:21 +08:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2018-08-08 20:22:50 +08:00
|
|
|
filename: "{{ kube_config_dir }}/heketi-deployment.json"
|
|
|
|
state: "{{ rendering.changed | ternary('latest', 'present') }}"
|
2019-05-16 15:27:43 +08:00
|
|
|
|
2018-08-08 20:22:50 +08:00
|
|
|
- name: "Ensure heketi is up and running."
|
|
|
|
changed_when: false
|
|
|
|
register: "heketi_state"
|
|
|
|
vars:
|
2019-05-16 15:27:43 +08:00
|
|
|
heketi_state:
|
|
|
|
stdout: "{}"
|
2018-08-08 20:22:50 +08:00
|
|
|
pods_query: "items[?kind=='Pod'].status.conditions|[0][?type=='Ready'].status|[0]"
|
|
|
|
deployments_query: "items[?kind=='Deployment'].status.conditions|[0][?type=='Available'].status|[0]"
|
|
|
|
command: "{{ bin_dir }}/kubectl get deployments,pods --selector=glusterfs --output=json"
|
|
|
|
until:
|
2019-04-01 17:38:33 +08:00
|
|
|
- "heketi_state.stdout|from_json|json_query(pods_query) == 'True'"
|
|
|
|
- "heketi_state.stdout|from_json|json_query(deployments_query) == 'True'"
|
2018-08-08 20:22:50 +08:00
|
|
|
retries: 60
|
|
|
|
delay: 5
|
2019-05-16 15:27:43 +08:00
|
|
|
|
|
|
|
- name: Set the Heketi pod name
|
|
|
|
set_fact:
|
2018-08-08 20:22:50 +08:00
|
|
|
heketi_pod_name: "{{ heketi_state.stdout|from_json|json_query(\"items[?kind=='Pod'].metadata.name|[0]\") }}"
|