2018-08-08 20:22:50 +08:00
|
|
|
---
|
2019-05-16 15:27:43 +08:00
|
|
|
- name: Get clusterrolebindings
|
|
|
|
register: "clusterrolebinding_state"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true"
|
2018-08-08 20:22:50 +08:00
|
|
|
changed_when: false
|
2019-05-16 15:27:43 +08:00
|
|
|
|
2018-08-08 20:22:50 +08:00
|
|
|
- name: "Kubernetes Apps | Deploy cluster role binding."
|
2021-11-05 04:10:23 +08:00
|
|
|
when: "clusterrolebinding_state.stdout | length == 0"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl create clusterrolebinding heketi-gluster-admin --clusterrole=edit --serviceaccount=default:heketi-service-account"
|
2019-05-16 15:27:43 +08:00
|
|
|
|
|
|
|
- name: Get clusterrolebindings again
|
|
|
|
register: "clusterrolebinding_state"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true"
|
2018-08-08 20:22:50 +08:00
|
|
|
changed_when: false
|
2019-05-16 15:27:43 +08:00
|
|
|
|
|
|
|
- name: Make sure that clusterrolebindings are present now
|
|
|
|
assert:
|
2021-07-12 15:00:47 +08:00
|
|
|
that: "clusterrolebinding_state.stdout | length > 0"
|
2019-01-10 03:01:47 +08:00
|
|
|
msg: "Cluster role binding is not present."
|
2018-08-08 20:22:50 +08:00
|
|
|
|
2019-05-16 15:27:43 +08:00
|
|
|
- name: Get the heketi-config-secret secret
|
|
|
|
register: "secret_state"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true"
|
2018-08-08 20:22:50 +08:00
|
|
|
changed_when: false
|
2019-05-16 15:27:43 +08:00
|
|
|
|
2018-08-08 20:22:50 +08:00
|
|
|
- name: "Render Heketi secret configuration."
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: "heketi.json.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/heketi.json"
|
2021-07-12 15:00:47 +08:00
|
|
|
mode: 0644
|
2019-05-16 15:27:43 +08:00
|
|
|
|
2018-08-08 20:22:50 +08:00
|
|
|
- name: "Deploy Heketi config secret"
|
2021-11-05 04:10:23 +08:00
|
|
|
when: "secret_state.stdout | length == 0"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl create secret generic heketi-config-secret --from-file={{ kube_config_dir }}/heketi.json"
|
2019-05-16 15:27:43 +08:00
|
|
|
|
|
|
|
- name: Get the heketi-config-secret secret again
|
|
|
|
register: "secret_state"
|
2019-05-03 05:24:21 +08:00
|
|
|
command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true"
|
2018-08-08 20:22:50 +08:00
|
|
|
changed_when: false
|
2019-05-16 15:27:43 +08:00
|
|
|
|
|
|
|
- name: Make sure the heketi-config-secret secret exists now
|
|
|
|
assert:
|
2021-11-05 04:10:23 +08:00
|
|
|
that: "secret_state.stdout | length > 0"
|
2019-01-10 03:01:47 +08:00
|
|
|
msg: "Heketi config secret is not present."
|