Skip to content

Instantly share code, notes, and snippets.

@mpolden
Created January 22, 2014 13:49
Show Gist options
  • Save mpolden/8559017 to your computer and use it in GitHub Desktop.
Save mpolden/8559017 to your computer and use it in GitHub Desktop.
Example for Ansible git-module and ssh agent forwarding
# files/env:
Defaults env_keep += "SSH_AUTH_SOCK"
# tasks/main.yml
- name: ensure sudo keeps SSH_AUTH_SOCK in environment
copy: src=env
dest=/etc/sudoers.d/env
mode=0440
owner=root
group=root
- name: clone repo from github
git: repo=ssh://git@github.com/example/example-repo.git
dest=/tmp/example-repo
# ~/.ssh/config
Host my-remote-ansible-host
ForwardAgent yes
# Make sure your key is added to ssh-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment