Answer the question
In order to leave comments, you need to log in
How to iterate over inventory variables?
Hello everyone
Remind pliz how to iterate over variable inventories?
right now I'm doing like this on this inventory
{% 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
Answer the question
In order to leave comments, you need to log in
out of date, found
- targets: ['{{ hostvars[host].ansible_private_ip }}:9273']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question