When map'ing a attribute in a list of nested variables, I am not able to retrieve its key.
I want to retrieve the key of "tls_cert_file" from followingemphasized text variables:
vault_config_listener:
- tcp:
- address: "0.0.0.0:8200"
- tls_cert_file: "/etc/ssl/wildcard.crt"
- tls_key_file: "/etc/ssl/private/wildcard.key"
- tls_require_and_verify_client_cert: "false"
- tcp:
- address: "127.0.0.1:8200"
- tls_disable: true
The debug task:
- debug:
msg: "{{ (vault_config_listener | selectattr('tcp', 'defined') | map(attribute='tcp')) | selectattr('tls_cert_file','defined') | map(attribute='tls_cert_file') | join('') | dirname }}"
The output:
ok: [test] => {
"msg": ""
}
I got the map'ing working until "tcp", but no further... What is wrong at the logic?