Can you use more than one inventory source at a time?
IntermediateConceptInventory
Answer
Yes. Pass -i several times, or point -i at a directory, and Ansible merges all files in it (static files, dynamic plugin configs and scripts).
ansible-playbook -i inventory/static.ini -i inventory/aws_ec2.yml site.yml
ansible-playbook -i inventory/ site.yml
Group variables from group_vars/ next to each source apply to the merged hosts. Hidden files and names ending in .orig, .bak, .retry are ignored in a directory source.
More on Inventory
What is an inventory and why does Ansible need one?BeginnerWhat are the INI and YAML inventory formats and how do they differ?BeginnerHow do you create groups of groups?BeginnerExplain host patterns: `:`, `:&`, `:!` and wildcards.IntermediateWhich connection variables can you set per host in inventory?BeginnerWhat are `group_vars` and `host_vars` directories?Intermediate