# Ansible azure dynamic inventory static filr

**URL:** <https://forum.ansible.com/t/ansible-azure-dynamic-inventory-static-filr/33470>\
**Category:** AWX Project\
**Tags:** azure\
**Created:** [July 23, 2020, 1:14pm UTC](https://forum.ansible.com/t/ansible-azure-dynamic-inventory-static-filr/33470 "2020-07-23T13:14:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kumaresan\_M](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@Kumaresan\_M](https://forum.ansible.com/u/Kumaresan_M)\
**Post date:** [July 23, 2020, 1:14pm UTC](https://forum.ansible.com/t/ansible-azure-dynamic-inventory-static-filr/33470/1 "2020-07-23T13:14:11Z")

</div>

Hi All,

I am using dynamic inventory to get the hosts from azure cloud it works fine as shown below.We need to store those output hosts in static file(/etc/ansible/hosts) is it possible?

# ansible all -m ping -i azure\_rm.yml --list  
&nbsp;&nbsp;hosts (2):  
&nbsp;&nbsp;&nbsp;&nbsp;ansible-inventory-test-vm1\_87cf  
&nbsp;&nbsp;&nbsp;&nbsp;ansible-inventory-test-vm2\_309e

# cat azure\_rm.yml

include\_vm\_resource\_groups:  
- ansible-inventory-test-rg  
auth\_source: auto

Regards  
Kumaresan

---

<div class="post-metadata">

**Author:** ![Rafael\_Tomelin](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rafael\_Tomelin](https://forum.ansible.com/u/Rafael_Tomelin)\
**Post date:** [July 24, 2020, 11:33am UTC](https://forum.ansible.com/t/ansible-azure-dynamic-inventory-static-filr/33470/2 "2020-07-24T11:33:21Z")

</div>

HI,

I use ansible-inventory

ansible-invanetory -i azure\_rm.yml --list --output inventory.ini

After use ansible all -m ping -i inventory.ini

---

<div class="post-metadata">

**Author:** ![Kumaresan\_M](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@Kumaresan\_M](https://forum.ansible.com/u/Kumaresan_M)\
**Post date:** [July 24, 2020, 3:35pm UTC](https://forum.ansible.com/t/ansible-azure-dynamic-inventory-static-filr/33470/3 "2020-07-24T15:35:55Z")

</div>

Hi,

Thanks. But ansible-inventory command pulls all the metadata of the vm.

Is it possible to display and store only hostname?

Regards  
Kumaresan
