employees:
sarav:
city: Coimbatore
email: sarav@gritfy.com
mobile: '985643210'
tasks:
- name: gathering_complete_data
ansible.builtin.debug:
msg={{ ['sarav'] | map('extract', employees , 'email' ) }}
output:
ok: [CS1] => {
"msg": [
"sarav@gritfy.com"
]
}
The above script is successfully working. When I made the data structure:
employees:
sarav:
- city: Coimbatore
email: sarav@gritfy.com
mobile: '985643210'
Using the Ansible map filter, I cannot gather the information(sarav's email ID).
Could anyone please share the code for fetching sarav's email ID?