Debugging inventory code

Inventory code deals with finding inventory sources, reading or executing the discovered files, parsing the inventory data into inventory objects, and loading variable data for the inventory. To debug how Ansible will deal with an inventory, a breakpoint must be added inside inventory/__init__.py or one of the other files within the inventory/ subdirectory. This directory will be located on the local filesystem wherever Ansible has been installed. On a Linux system, this is typically stored in the /usr/lib/python2.7/site-packages/ansible/inventory/ path. This path may be inside a Python virtual environment if Ansible has been installed that way. To discover where Ansible is installed, simply type which ansible from ...

Get Mastering Ansible - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.