ansible.builtin.script inventory – Executes an inventory script that returns JSON
Note
This inventory plugin is part of ansible-core
and included in all Ansible
installations. In most cases, you can use the short
plugin name
script
.
However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.script
for easy linking to the
plugin documentation and to avoid conflicting with other collections that may have
the same inventory plugin name.
Synopsis
The source provided must be an executable that returns Ansible inventory JSON
The source must accept
--list
and--host <hostname>
as arguments.--host
will only be used if no_meta
key is present. This is a performance optimization as the script would be called per host otherwise.
Parameters
Parameter |
Comments |
---|---|
Toggle display of stderr even when script was successful Choices:
Configuration:
|
Notes
Note
Enabled in configuration by default.
The plugin does not cache results because external inventory scripts are responsible for their own caching.
To write your own inventory script see (Developing dynamic inventory from the documentation site.
To find the scripts that used to be part of the code release, go to https://github.com/ansible-community/contrib-scripts/.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.