fix some common tasks
[awsible] / roles / common / tasks / awsacct.yml
1 ---
2 - name: Fetch IAM info
3 uri:
4 url: http://169.254.169.254/latest/meta-data/iam/info
5 return_content: yes
6 register: iamInfo
7 - name: Extract Account ID
8 set_fact:
9 aws_account: "{{ (iamInfo.content|from_json).InstanceProfileArn | regex_replace('^arn:aws:iam::(\\d+):.*','\\\\1') }}"