---
- name: Get heketi deployment config
  oc_obj:
    state: list
    kind: deploymentconfig
    namespace: "{{ glusterfs_namespace }}"
    name: "deploy-heketi-{{ glusterfs_name }}"
  register: glusterfs_heketi_deployment_config

- name: Set heketi admin key
  set_fact:
    glusterfs_heketi_admin_key: "{{ (glusterfs_heketi_deployment_config.module_results.results[0].spec.template.spec.containers[0].env | selectattr('name', 'match', '^HEKETI_ADMIN_KEY$') | first).value }}"
  when: glusterfs_heketi_deployment_config.module_results.results[0]
