ansible-for-devops icon indicating copy to clipboard operation
ansible-for-devops copied to clipboard

Use inventory plugin instead of script for Python dynamic inventory example

Open geerlingguy opened this issue 5 years ago • 4 comments

See: Developing dynamic inventory.

Scripts are now actually executed using the 'script' inventory plugin. It's preferred nowadays to write an inventory plugin to use dynamic inventory rather than writing an inventory script (unless you want to maintain the script in a non-Python language).

So maybe keep the PHP-based script example, but change the Python one to an inventory plugin.

geerlingguy avatar Feb 05 '20 19:02 geerlingguy

And a few more examples I found today from AnsibleFest 2019:

  • https://github.com/willtome/managing-meaningful-inventories
  • https://www.ansible.com/hubfs//AnsibleFest%20ATL%20Slide%20Decks/AnsibleFest%202019%20-%20Managing%20Meaningful%20Inventories.pdf

geerlingguy avatar Feb 05 '20 19:02 geerlingguy

Also some helpful inventory debugging commands, like:

ansible-inventory -i [inventory] --list

geerlingguy avatar Feb 05 '20 19:02 geerlingguy

Merging older issue #120 into this one.

geerlingguy avatar Feb 05 '20 19:02 geerlingguy

Highly related: #275, Episode 11 of Ansible 101 live stream.

geerlingguy avatar Jun 03 '20 03:06 geerlingguy