Hosts and Inventory
Ansible offers an inventory system that helps administrators manage the devices they intend to target via Ansible playbook execution or ad hoc command execution. The inventory system allows the administrator to identify inventory items (devices) and group them according to their needs. These inventory items are maintained via Ansible inventory files, which can then be targeted directly via the command line.
Out-of-the-box, Ansible offers a default inventory file, which is typically located in the /etc/ansible/hosts
file location. If one inventory file is not enough to effectively manage your inventory, additional inventory files can be created and stored either in the same location or in a location of your choosing. When calling the ansible-playbook
command to invoke Ansible and execute either an ad hoc command or trigger a playbook run
, Ansible has the -i
option to allow alternate inventory files to be specified directly on the command line. The following is a set of...