It seems that in the ansible world there are a bit too many ways to deal with inventory and we faced some hard questions.
We currently have 4 official target environments: production, staging, testing and local (localhost). Now they are all groups of hosts inside a single inventory.ini which is located in the root.
Almost all entire infrastructure is running on AWS, the only exception is that some developers are running their local environment on localhost or a local VM. Still, all the other non-personal environments are on AWS.
Some staff would like to split this into different inventories for each environment in order to avoid accidental execution against all at once. I am a bit concerned that this could increase the maintenance costs and that will probably make harder to work with tools like Ansible Tower, Semamphore or RunDeck. I also want to switch to ec2 dynamic inventory which makes the split less intersting.
Here are few questions that have to be addresed by an optimal setup:
- how do I deploy a specific component towards a specific environment?
- how do I test a playbook without affecting production or staging?
- what default value should he keep as "hosts: value" inside our playbooks
- what should be the default inventory if we would use multiple files
- how can we deploy something against the entire infrastructure (multiple inventories at the same time)