Answer the question
In order to leave comments, you need to log in
ANSIBLE how to get ip addresses from inventory file group?
I apologize for such a trivial question, but I just can’t find an example for getting IP from the inventory group of a file.
Tried like this:
- name: host
debug: msg="{{ item }}"
with_items:
- "{{ groups['SYNC-HOSTS'].['ansible_hostname'] }}"
Answer the question
In order to leave comments, you need to log in
Thanks everyone, issue closed.
- name: host
debug: msg="{{ hostvars[item]['ansible_host'] }}"
with_items:
- "{{ groups['SYNC-HOSTS'] }}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question