Ansible - ini dynamic inventory plugin

If you are not familiar dynamic inventory, check out Ansible - Getting Started with Dynamic Inventory.

This assumes you have the ini plugin in ansible.cfg enabled, like this.

# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini'
enable_plugins = host_list, yaml, ini


This also assumes you have defined your inventory in a ini file, such as hosts.ini. Let's say the hosts.ini file contains the following managed hosts (e.g. the target systems).


The ansible command with the --list-hosts and -vvv flags can be used to determine if the ini plugin is being used.

ansible all --list-hosts -vvv


If you get something like this, this suggests you did not define ini in ansible.cfg properly.

[WARNING]: Unable to parse /etc/ansible/hosts.ini as an inventory source


If the following is returned, the ini plugin is being used.

Parsed /etc/ansible/hosts.ini inventory source with ini plugin


Something like this should be returned.

  hosts (6):


Or, the ansible-inventory --list command can be used.

ansible-inventory --list


Or, the ansible-inventory --graph command can be used.

ansible-inventory --graph


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 3ad95 in the box below so that we can be sure you are a human.