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