--- /dev/null
+---
+- name: Fetch IAM info
+ uri:
+ url: http://169.254.169.254/latest/meta-data/iam/info
+ return_content: yes
+ register: iamInfo
+- name: Extract Account ID
+ set_fact:
+ aws_account: "{{ (iamInfo.content|from_json).InstanceProfileArn | regex_replace('^arn:aws:iam::(\\d+):.*','\\\\1') }}"
group: root
- name: Install any facts.
- with_items: "{{ fact_scripts|default(None) }}"
+ with_items: "{{ fact_scripts|default([]) }}"
copy:
dest: /etc/ansible/facts.d/{{ item }}.fact
src: "{{ item }}.fact"