0

I am creating ec2 instances and configuring them using ansible scripts. I have used

[ssh_connection]
pipelining=true

in my ansible.cfg file but it still asks to verify the ssh fingerprint, when I type yes and press enter it fails to login to the instance. Just to let you know I am using ansible dynamic inventory and hence am not storing IPs or dns in hosts file. Any help will be much appreciated.

TIA

  • 1
    Are you able to ssh into your ec2 instances manually without a problem? – larsks Sep 02 '15 at 11:51
  • yes, I am able to ssh manually. If i remove the ansible.cfg file then again ansible asks for host verification but this time when I type yes it lets me in – Saurabh Kumar Jha Sep 03 '15 at 05:18

2 Answers2

2

Pipelining doesn't have any effect on authentication - it bundles up individual module calls into one bigger file to transfer over once a connection has been established.

In order not to stop execution and prompt you to accept the SSH key, you need to disable strict host key checking, not enable pipelining.

You can set that by exporting ANSIBLE_HOST_KEY_CHECKING=False or set it in ansible.cfg with:

[defaults] host_key_checking=False

The latter is probably better for your use case, because it's persistent.

Note that even though this is a setting that deals with ssh connections, it is in the [defaults] section, not the [ssh_connection] one.

==

The fact that when you type yes you fail to log in makes it seem like this might not be your only problem, but you haven't given enough information to solve the rest.

If you're still having connection issues after disabling host key checking, edit the question to add the output of you SSHing into the instance manually, alongside the output of an ansible play with -vvv for verbose output.

First steps to look through when troubleshooting:

  • What are the differences between when I connect and when Ansible does?
  • Is the ansible_ssh_user set to the right user for the ec2 instance?
  • Is the ansible_ssh_private_key_file the same as the private part of the keypair you assigned the instance on creation?
  • Is ansible_ssh_host set correctly by whatever is generating your dynamic inventory?
nikobelia
  • 3,775
  • 1
  • 16
  • 26
0

I think you can find the answer here: ansible ssh prompt known_hosts issue

Basically, when you run ansible-playbook, you will need to use the argument:

ANSIBLE_HOST_KEY_CHECKING=False

Make sure you have your private key added (ssh-add your_private_key).

Community
  • 1
  • 1
catagon87
  • 528
  • 4
  • 21