in Technology by
What is Ansible Inventory and its types?

1 Answer

0 votes
by

In Ansible, there are two types of inventory files: Static and Dynamic.

  • Static inventory file is a list of managed hosts declared under a host group using either hostnames or IP addresses in a plain text file. The managed host entries are listed below the group name in each line. For example
[gatewayed]
staging1 ansible_host=10.0.2.1
staging2 ansible_host=10.0.2.2
  • Dynamic inventory is generated by a script written in Python or any other programming language or by using plugins(preferable). In a cloud setup, static inventory file configuration will fail since IP addresses change once a virtual server is stopped and started again. We create a demo_aws_ec2.yaml file for the config such as
plugin: aws_ec2 regions:
ap-south-1 filters:
tag:tagtype: testing

Now we can fetch using this command

ansible-inventory -i demo_aws_ec2.yaml -graph

Related questions

+1 vote
    Where is Inventory file located by default? (1)/etc/configurations (2)/etc/ansible (3)/etc/ansible (4)/etc/ansible/hosts...
asked Oct 13, 2020 in Technology by JackTerrance
0 votes
    What is Ansible Tower and what are its features?...
asked Jul 29, 2021 in Technology by JackTerrance
0 votes
    What is Dependency Injection and its types in laravel?...
asked Sep 30, 2021 in Technology by JackTerrance
0 votes
    What is sniffing and what are its types?...
asked Feb 16, 2021 in Technology by JackTerrance
0 votes
    What do you mean by Trojan and explain its types?...
asked Feb 15, 2021 in Technology by JackTerrance
0 votes
    What is BLOB and its types in MySQL?...
asked Nov 30, 2020 in Technology by JackTerrance
0 votes
    What is User-defined function? What are its various types?...
asked Dec 11, 2020 in Technology by JackTerrance
0 votes
    What is a Subquery? What are its types?...
asked Dec 9, 2020 in Technology by JackTerrance
0 votes
    What is an Index? Explain its different types....
asked Dec 9, 2020 in Technology by JackTerrance
0 votes
    What is a Join? List its different types....
asked Dec 8, 2020 in Technology by JackTerrance
0 votes
    What is Nationalism? Explain its types. Please answer the above question....
asked Aug 4, 2022 in Education by JackTerrance
0 votes
    What is Nationalism? Explain its types. Please answer the above question....
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    I have a function value(x) which is overloaded for many types such that: double value(double x) { return x; } double ... [-Wreturn-local-addr] in the following code: Matrix33 m; m...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    .Computer can do different types of task, it show its which characteristics? A.. Fast B.. Accuracy C.. Diligence D.. Versatility Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    How are CD and CI related to Ansible?...
asked Jan 28, 2023 in Technology by JackTerrance
...