Create multiple dynamic inventories or custom dynamic inventory?

Hi,
We have multiple aws accounts and want to use ansible as a configuration management system for them, so how do we proceed, to manage multiple aws accounts with one ansible server.

  1. we have an account that is peered to all other accounts, so i want to install ansible there.
  2. but how do i proceed with inventory, how to differentiate between different aws accounts, because ec2.py would act as dynamic inventory for one account , how to have different envionments, and how to run playbooks on different accounts and vpcs, should we create a custom inventory?

Hey,

No idea what the best practice would be, but you could customize the ec2.py script and change the following line: https://github.com/ansible/ansible/blob/devel/contrib/inventory/ec2.py#L223You could hardcode it or make it dynamic.

So you could have ec2_account1.py with ec2_account1.ini, ec2_account2.py with ec2_account2.ini, etc.

Regards,
Simon

https://github.com/caredotcom/ansible-quartermaster might help you get
what you need here.

                                      -Josh (jbs@care.com)

(apologies for the automatic corporate disclaimer that follows)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.