Ansible azure dynamic inventory static filr

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
  hosts (2):
    ansible-inventory-test-vm1_87cf
    ansible-inventory-test-vm2_309e

# cat azure_rm.yml

include_vm_resource_groups:
- ansible-inventory-test-rg
auth_source: auto

Regards
Kumaresan

HI,

I use ansible-inventory

ansible-invanetory -i azure_rm.yml --list --output inventory.ini

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

Hi,

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

Is it possible to display and store only hostname?

Regards
Kumaresan