Created
March 1, 2017 14:11
-
-
Save danslapman/ba110a93c472e3a0993eefd83ca6a656 to your computer and use it in GitHub Desktop.
Login to ecr
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
--- | |
- name: Obtain Amazon ECR token | |
shell: | | |
docker run -i --rm \ | |
-e "AWS_KEY={{ amazon_ecr_aws_key }}" \ | |
-e "AWS_SECRET_KEY={{ amazon_ecr_aws_secret_key }}" \ | |
opedge/awscli:latest \ | |
aws ecr --region us-east-1 get-authorization-token | |
register: ecr_token_result | |
- set_fact: | |
aws_ecr_token: "{{ ((ecr_token_result.stdout | from_json)['authorizationData'][0]['authorizationToken']) | b64decode }}" | |
- set_fact: | |
docker_registry_username: "{{ aws_ecr_token.split(':')[0] }}" | |
- set_fact: | |
docker_registry_password: "{{ aws_ecr_token.split(':')[1] }}" | |
- name: Obtain Amazon ECR login command | |
shell: | | |
docker run -i --rm \ | |
-e "AWS_KEY={{ amazon_ecr_aws_key }}" \ | |
-e "AWS_SECRET_KEY={{ amazon_ecr_aws_secret_key }}" \ | |
babotech/awscli:latest \ | |
aws ecr --region us-east-1 get-login | |
register: ecr_docker_login | |
- name: Docker login | |
shell: "{{ ecr_docker_login.stdout }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment