inventory script

An executable program that prints the inventory as JSON when Ansible runs it with --list, and one host's variables with --host.

In more detail

It is the original dynamic inventory mechanism and still works, but Ansible cannot cache, validate or configure it. It must be executable, because Ansible decides whether to run or parse a file by asking the operating system. Write one only when no plugin exists for your source.

Examples

chmod +x dynamic.py
ansible-inventory -i dynamic.py --graph

Related terms

Taught in

References

Certification courses