Hi,
I would like to share that i managed to collect inventory information with only minor changes in ansible playbook.
sharing just to help other people who new learner like me.
write facts in inventory
- name: write the inventory in into file
copy:
content: |
MGMT_IP;HOSTNAME;MODEL;VERSION;IMAGE;
{% for host in ansible_play_hosts %}
{{ hostvars[host].inventory_hostname}};{{ hostvars[host].facts_output.ansible_facts.ansible_net_hostname }};{{ hostvars[host].facts_output.ansible_facts.ansible_net_model }};{{ hostvars[host].facts_output.ansible_facts.ansible_net_version }};{{ hostvars[host].facts_output.ansible_facts.ansible_net_image }}
{% endfor %}
dest: /etc/ansible/facts/systems.csv
backup: yes
output will look like below after minor changes in excel.