top of page
  • Writer's pictureplusforum. in

02 - Ansible - Host Inventory

Ansible Inventory is one in which we maintain a list of all target (remote) servers that we want to manage using Ansible. This file can be updated manually by maintaining a static file or dynamically using a program or a script.

Inventory is maintained in two ways, static inventory and dynamic inventory.

A manually maintained static inventory file is written as shown below.











A static inventory file can also be maintained in YAML file format. A sample one is as shown below. Use command,

$ ansible-inventory --list











The inventory file contents can be visualized in hierarchical manner as well. Use options in the command 'ansible-inventory'.

$ ansible-inventory … this command helps in managing inventories, static inventory. and the output can be displayed in YAML format or in graphical representation.











Inventory Management is important for effective and efficient use of Ansible to control your entire environment.

We can break it up in to the environments, like production and test etc. Thus, maintaining separate inventory files for specific environments.

Comments


bottom of page