def get_account_id(region):
client = boto3.client('iam', region_name=region)
try:
account_id = client.list_users()['Users'][0]['Arn'].split(':')[4]
return account_id
except Exception:
raise errors.AnsibleFilterError(
"Failed to retrieve account id"
)
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e5d91ca1-80bf-4652-aecd-8ea0feb77d9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.