From: Justin Wind Date: Thu, 9 Mar 2017 21:34:58 +0000 (-0800) Subject: fix some common tasks X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=959f205e82efbae0d89d1c34e29fb34b3b15afa6;p=awsible fix some common tasks --- diff --git a/roles/common/tasks/awsacct.yml b/roles/common/tasks/awsacct.yml new file mode 100644 index 0000000..fdc9f8f --- /dev/null +++ b/roles/common/tasks/awsacct.yml @@ -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') }}" diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index b92b517..1cbf044 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -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" diff --git a/roles/common/tasks/volumes.yml b/roles/common/tasks/volumes.yml index 8d09506..530d81b 100644 --- a/roles/common/tasks/volumes.yml +++ b/roles/common/tasks/volumes.yml @@ -25,3 +25,6 @@ file: state: link path: /data + src: "{{ data_mount_path }}" + owner: ec2-user + group: ec2-user diff --git a/roles/common/files/aws.config.j2 b/roles/common/templates/aws.config.j2 similarity index 100% rename from roles/common/files/aws.config.j2 rename to roles/common/templates/aws.config.j2