hi folks
here is my host file
[target1]
4.109.119.23 ansible_user=ec2-user ansible_ssh_private_key_file=/root/ansible_by_kodekloud/hybrid.pem[target2]
3.11.29.248 ansible_alias=target2 ansible_user=ec2-user ansible_ssh_private_key_file=/root/ansible_by_kodekloud/hybrid.pem dns_ip=10.1.1.1
and the playbook is here
---
- name: variables
hosts: all
tasks:
- shell:
echo "{{hostvars['target2'][ansible_facts][mount]}}" > /tmp/my
- debug:
msg: "{{hostvars['target2'].dns_ip}}"
i want to access the variable of target2 but i am not able to access this info
if any idea where i am doing wrong let me know thanks