Created
January 6, 2020 06:31
-
-
Save markuman/b5d77b01484e1cdccef9154aab5b2664 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: False | |
vars: | |
duration: 7200 | |
vars_prompt: | |
- name: TOTP | |
prompt: TOTP needed only for iam operations | |
private: no | |
default: "" | |
tasks: | |
- name: fetch MFA device info | |
iam_mfa_device_info: | |
profile: "{{ YOUR_AWS_PROFILE }}" | |
register: mfa_devices | |
- name: sts credentials with MFA | |
sts_session_token: | |
duration_seconds: "{{ duration }}" | |
profile: "{{ YOUR_AWS_PROFILE }}" | |
region: eu-central-1 | |
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}" | |
mfa_token: "{{ TOTP }}" | |
register: mfa_assumed_role | |
- debug: msg="{{mfa_assumed_role}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment