til*_*lda 31 git ssh timeout ssh-agent ansible
我已经设置了我能找到的每一个,但仍然从GitHub克隆一个repo挂起了配置过程.
我有:
的.ssh /配置
Host github.com
ForwardAgent yes
StrictHostKeyChecking no
Run Code Online (Sandbox Code Playgroud)复制私钥
vagrant用户身份运行该剧是:
- name: Checkout from git
git: repo=git@github.com:username/repositoryname.git dest=/srv/website
Run Code Online (Sandbox Code Playgroud)Tom*_*don 61
只是为了扩展到fifda的答案,该配置可以放在你的剧本旁边的ansible.cfg文件中.例如:
ansible.cfg
[defaults]
transport = ssh
[ssh_connection]
ssh_args = -o ForwardAgent=yes
Run Code Online (Sandbox Code Playgroud)
我认为这样做比设置为env变量更好,因为将它放在conf文件中既更具声明性,也可以最大限度地减少您与项目合作的其他人所需的步骤.
Conf docs:http: //docs.ansible.com/intro_configuration.html#the-ansible-configuration-file
配置文件示例:https: //raw.github.com/ansible/ansible/devel/examples/ansible.cfg
til*_*lda 14
我想分享对我有用的答案:
https://groups.google.com/forum/#!msg/ansible-project/u6o-sWynMjo/69UwJfJPq7cJ - 来自Ansible Google Group
对于ansible,ssh-add首先在主机中加载ssh密钥.然后使用"ssh"作为连接类型并启用转发.
如:
Run Code Online (Sandbox Code Playgroud)$ ssh-add $ export ANSIBLE_TRANSPORT="ssh" $ export ANSIBLE_SSH_ARGS="-o ForwardAgent=yes"有关运行代理的信息,请参阅ssh-add手册.
Ansible文档ssh-args是http://docs.ansible.com/intro_configuration.html#ssh-args
这对我有用
- name: ensure known hosts
shell: touch ~/.ssh/known_hosts
- name: remove github.com from known host
shell: ssh-keygen -R github.com
# >> instead of > to keep existing known_hosts file
- name: ensure github.com in known host
shell: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18066 次 |
| 最近记录: |