Re: [ansible-project] Re: Getting aws account id

2016-05-17 Thread Erick Vitor de Barros
Thanks Allen, I'll give it a try ! On Wed, May 18, 2016 at 3:32 PM, Allen Sanabria wrote: > You can use a Ansible Filter Plugin. > > I have a repo with all of my filter plugins. Line 8 has the function you > need. > > def get_account_id(region): > client =

[ansible-project] Re: Getting aws account id

2016-05-17 Thread Allen Sanabria
You can use a Ansible Filter Plugin. I have a repo with all of my filter plugins. Line 8 has the function you need. def get_account_id(region): client = boto3.client('iam', region_name=region) try: account_id = client.list_users()['Users'][0]['Arn'].split(':')[4] return