Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
---
# test SSH agent forwarding
- shell: echo "Client= [$SSH_CLIENT] Sock= [$SSH_AUTH_SOCK]"
sudo: no
register: myecho
- debug: msg="{{myecho.stdout}}"
- shell: ssh-add -l
sudo: no
register: myecho
- debug: msg="{{myecho.stdout}}"
# - shell: ssh -T -vvvv git@github.com
# register: myecho
# - debug: msg="{{myecho.stdout}}"
- name: Get app from github
sudo: no
git:
repo=git@github.com:myprivate/repo.git
dest=git-repo/myproject.git
accept_hostkey=yes
force=yes
bare=yes
update=yes
version="{{ git_branch }}"
- name: Create project folder
become: yes
become_user: root
become_method: sudo
file: path=/home/{{ base_user}}/{{ project_folder }}
owner={{ base_user }}
group={{ base_user }}
mode=0774
state=directory
- name: checkout app to project folder
environment:
GIT_WORK_TREE: /home/{{ base_user }}/{{ project_folder }}
shell:
git checkout {{ git_branch}} -f
chdir=/home/{{ base_user}}/git-repo/myproject.git/
@pogorelov-ss

This comment has been minimized.

Copy link
Owner Author

@pogorelov-ss pogorelov-ss commented Oct 6, 2015

I have this in my ~/.ssh/config file but remember that * for Hosts is unsecured

Host *
ForwardAgent yes

@kjagiello

This comment has been minimized.

Copy link

@kjagiello kjagiello commented Sep 4, 2017

Be really carefull with Host *. As @pogorelov-ss says, it is not really secure. https://heipei.github.io/2015/02/26/SSH-Agent-Forwarding-considered-harmful/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.