fix some common tasks
authorJustin Wind <j.wind@partner.samsung.com>
Thu, 9 Mar 2017 21:34:58 +0000 (13:34 -0800)
committerJustin Wind <j.wind@partner.samsung.com>
Thu, 9 Mar 2017 21:34:58 +0000 (13:34 -0800)
roles/common/tasks/awsacct.yml [new file with mode: 0644]
roles/common/tasks/main.yml
roles/common/tasks/volumes.yml
roles/common/templates/aws.config.j2 [moved from roles/common/files/aws.config.j2 with 100% similarity]

diff --git a/roles/common/tasks/awsacct.yml b/roles/common/tasks/awsacct.yml
new file mode 100644 (file)
index 0000000..fdc9f8f
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- 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') }}"
index b92b5174c4aec46dd83c560563221b396dbacd2f..1cbf04470d9807b6e5eec5be32c12b3018455672 100644 (file)
@@ -46,7 +46,7 @@
     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"
index 8d095064ddcb18b02ac2c90556d89f1069d5480d..530d81bc056fa05c106c1855c216a7c6d82b77b8 100644 (file)
@@ -25,3 +25,6 @@
   file:
     state: link
     path: /data
+    src: "{{ data_mount_path }}"
+    owner: ec2-user
+    group: ec2-user