Skip to content

Instantly share code, notes, and snippets.

@pogorelov-ss
Last active September 4, 2017 10:20
Show Gist options
  • Save pogorelov-ss/41893e17c7c4776d4d57 to your computer and use it in GitHub Desktop.
Save pogorelov-ss/41893e17c7c4776d4d57 to your computer and use it in GitHub Desktop.
---
# 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
Copy link
Author

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

Host *
ForwardAgent yes

@kjagiello
Copy link

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