How to iterate through a variable inventary?

Hello
Recall. how to iterate through a variable inventories?
right now doing so here in such inventories
{% for host in groups['all'] %}
 - targets: ['{{ host }}:9273']
labels:
 stage_name: "{{ host }}"


[linux servers]
awesome1 ansible_host=8.8.8.8 ansible_private_ip=10.0.0.0
awesome2 ansible_host=8.8.8.8 ansible_private_ip=10.0.0.0
awesome3 ansible_host=8.8.8.8 ansible_private_ip=10.0.0.0


but it shows hostname (awesome) and I need ansible_private_ip

I'm not sure how this is done, recall pliz who knows
April 19th 20 at 12:44
1 answer
April 19th 20 at 12:46
Solution
irrelevant, found
- targets: ['{{ hostvars[host].ansible_private_ip }}:9273']

Find more questions by tags Ansible