Created
May 29, 2015 04:27
-
-
Save smellman/a148f40195af43f8d081 to your computer and use it in GitHub Desktop.
awscliの設定をansibleに渡すための何か
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
| #!/bin/bash | |
| credentials=~/.aws/credentials | |
| profile=$1 | |
| # ini parser: http://qiita.com/srea/items/28073bc90d65eed0856d | |
| eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \ | |
| -e 's/;.*$//' \ | |
| -e 's/[[:space:]]*$//' \ | |
| -e 's/^[[:space:]]*//' \ | |
| -e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \ | |
| < $credentials \ | |
| | sed -n -e "/^\[$profile\]/,/^\s*\[/{/^[^;].*\=.*/p;}"` | |
| export AWS_DEFAULT_PROFILE=$1 | |
| export AWS_ACCESS_KEY_ID=$aws_access_key_id | |
| export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment