I have set up everyhing I could find, but still cloning a repo from GitHub hangs the provisioning process.
I have:
.ssh/config
Host github.com ForwardAgent yes StrictHostKeyChecking no
copied private key
vagrant
userthe play is:
- name: Checkout from git git: [email protected]:username/repositoryname.git dest=/srv/website
Testing SSH agent forwarding To test that agent forwarding is working with your server, you can SSH into your server and run ssh -T [email protected] once more. If all is well, you'll get back the same prompt as you did locally.
By default, Ansible assumes you are using SSH keys to connect to remote machines. SSH keys are encouraged, but you can use password authentication if needed with the --ask-pass option. If you need to provide a password for privilege escalation (sudo, pbrun, and so on), use --ask-become-pass .
Agent forwarding comes with a risk When you forward ssh-agent 's Unix domain socket to a remote host, it creates a security risk: anyone with root access on the remote host can discreetly access your local SSH agent through the socket. They can use your keys to impersonate you on other machines on the network.
From the configuration, go to Connection > SSH > Auth and enable “Allow agent forwarding.” You can also add your private key file from the same pane. PuTTY will handle the SSH agent for you, so you don't have to mess around with any config files.
Just to expand on tillda's answer, that config can be placed in an ansible.cfg file alongside your playbook. e.g.:
ansible.cfg
[defaults] transport = ssh [ssh_connection] ssh_args = -o ForwardAgent=yes
I'd say it's better to do that than setting as an env variable, as placing it in a conf file is both more declarative and also will minimise the steps needed for other people you may be working with to going with a project.
Conf docs: http://docs.ansible.com/intro_configuration.html#the-ansible-configuration-file
Example config file: https://raw.github.com/ansible/ansible/devel/examples/ansible.cfg
I want to share the answer that worked for me:
https://groups.google.com/forum/#!msg/ansible-project/u6o-sWynMjo/69UwJfJPq7cJ - From Ansible Google Group
For ansible, ssh-add to load ssh keys in your host machine first. Then use "ssh" as connection type with forwarding enabled.
Such as:
$ ssh-add $ export ANSIBLE_TRANSPORT="ssh" $ export ANSIBLE_SSH_ARGS="-o ForwardAgent=yes"
See manual for ssh-add for running the agent.
The Ansible docs for ssh-args
are http://docs.ansible.com/intro_configuration.html#ssh-args
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With