Add aws_caller_facts module and use it in setup-iam.yml (#36683)

* Add aws_caller_facts module and use it in setup-iam.yml

This removes the dependency on having the command line AWS tools
installed.
This commit is contained in:
Ed Costello
2018-02-28 19:30:34 +13:00
committed by Will Thames
parent db43fe6a76
commit 645952c139
4 changed files with 103 additions and 4 deletions

View File

@@ -25,13 +25,12 @@
when: iam_group is not defined
- name: Get aws account ID
command: aws sts get-caller-identity --output text --query 'Account' "{{ '--profile=' ~ profile if profile else '' }}"
changed_when: False
register: aws_account_command
aws_caller_facts:
register: aws_caller_facts
- name: Set aws_account_fact
set_fact:
aws_account: "{{ aws_account_command.stdout }}"
aws_account: "{{ aws_caller_facts.account }}"
- name: Ensure Managed IAM policies exist