--- - name: Get secret k8s_info: version: v1 kind: Secret namespace: '{{ ansible_operator_meta.namespace }}' name: "{{ item }}" register: _secret no_log: "{{ no_log }}" - name: Backup secret if exists block: - name: Set secret key set_fact: _data: "{{ _secret['resources'][0]['data'] }}" _type: "{{ _secret['resources'][0]['type'] }}" no_log: "{{ no_log }}" - name: Create and Add secret names and data to dictionary set_fact: secret_dict: "{{ secret_dict | default({}) | combine({item: { 'name': item, 'data': _data, 'type': _type }}) }}" no_log: "{{ no_log }}" when: _secret | length