FreeKB - Ansible ansible-doc inventory
Ansible - ansible-doc inventory

By default, the ansible-doc command will use module as the type, thus the -t or --type option followed by inventory must be used to display documentation on inventory.

The -l or --list option can be used to display the dynamic inventory plugins that can be used. Refer to Ansible - Getting Started with the Dynamic Inventory Plugin for more details on dynamic inventory.

ansible-doc --type inventory --list

advanced_host_list Parses a 'host list' with ranges
constructed        Uses Jinja2 to construct vars and groups based on existing inventory.
host_list          Parses a 'host list' string
ini                Uses an Ansible INI file as inventory source.
openstack          OpenStack inventory source
script             Executes an inventory script that returns JSON
virtualbox         virtualbox inventory source
yaml               Uses a specifically YAML file as inventory source.


Let's say you want to learn about "host_list". The -s or --snippet option can be used.

ansible-doc --type inventory --snippet host_list

> HOST_LIST    (/usr/local/lib/python3.6/site-packages/ansible/plugins/inventory/

        Parses a host list string as a comma separated values of hosts This plugin only applies to inventory strings that are not paths and contain a

  * This module is maintained by The Ansible Community
          - preview
          supported_by: community


# define 2 hosts in command line
    # ansible -i ',' -m ping all

    # DNS resolvable names
    # ansible -i ', host2' -m user -a 'name=me state=absent' all

    # just use localhost
    # ansible-playbook -i 'localhost,' play.yml -c local


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 daa8f in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |