Skip to content

Instantly share code, notes, and snippets.

@felipe1982
Created March 20, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipe1982/a2b210cc86fa3cdd3e6ce6354648d495 to your computer and use it in GitHub Desktop.
Save felipe1982/a2b210cc86fa3cdd3e6ce6354648d495 to your computer and use it in GitHub Desktop.
---
#
# Run this command on your local laptop to:
# 1. Create Remote "Origin" for codecommit repo
# 2. Configure Credential Helper for IAM authentication to repository.
#
- hosts: 'youi-ops-np'
connection: local
tasks:
- name: Check if "origin" exists
command: git remote
register: git_remote
- name: Delete remote origin if it exists
command: git remote rm origin
when: "'origin' in git_remote.stdout"
- name: Create Git Remote
command: 'git remote add origin {{ codecommit_repo_url }}'
- name: Configure AWS Credential Helper
command: >-
git config --local
credential.https://git-codecommit.{{ aws_region }}.amazonaws.com.helper
'!aws --profile "{{ inventory_hostname }}" codecommit credential-helper $@'
- name: Configure AWS Use Http Path
command: >-
git config --local
credential.https://git-codecommit.{{ aws_region }}.amazonaws.com.usehttppath
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment