Docker-machine and Openstack / SSH - ssh

I have a problem with docker-machine and openstack
running this command
docker-machine --debug create -d openstack --openstack-username admin --openstack-password admin --openstack-tenant-name admin --openstack-auth-url http://163.172.5.197:5000/v2.0 --openstack-flavor-id bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 --openstack-image-id 871a5ddf-a888-4b45-9201-78da07e6cdcb testmachine
gives me the output as follow
Docker Machine Version: 0.6.0, build e27fb87
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:46658
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:44014
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(testmachine) Calling .GetMachineName
(testmachine) Calling .DriverName
(testmachine) Calling .GetCreateFlags
(testmachine) Calling .SetConfigFromFlags
Running pre-create checks...
(testmachine) Calling .PreCreateCheck
(testmachine) Calling .GetConfigRaw
Creating machine...
(testmachine) Calling .Create
(testmachine) DBG | Authenticating... map[Insecure:false DomainID: DomainName: Username:admin TenantName:admin TenantID: AuthUrl:http://163.172.5.197:5000/v2.0]
(testmachine) DBG | Found tenant id using its name map[Name:admin ID:3247c97c6abf4c07aee78043a1caa261]
(testmachine) DBG | Creating Key Pair... map[Name:testmachine-5f792f35e57c8749b3a39074cc230831a6902250f91c7f76fb30299ad00713be]
(testmachine) Creating machine...
(testmachine) DBG | Creating OpenStack instance... map[FlavorId:bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 ImageId:871a5ddf-a888-4b45-9201-78da07e6cdcb]
(testmachine) DBG | Waiting for the OpenStack instance to be ACTIVE... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Looking for the IP address... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) Calling .GetConfigRaw
(testmachine) Calling .DriverName
(testmachine) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(testmachine) Calling .GetState
(testmachine) DBG | IP address found map[IP:10.0.0.2 MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Get status for OpenStack instance... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | State for OpenStack instance map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a State:ACTIVE]
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root#10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
command : exit 0
err : exit status 255
output :
Getting to WaitForSSH function...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root#10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0
then when i am trying to run docker-machine ls
testmachine - openstack Running tcp://10.0.0.2:2376 Unknown Unable to query docker version: Unable to read TLS config: open /home/martin/.docker/machine/machines/testmachine/server.pem: no such file or directory
Logs in openstack for machine :
open-vm-tools: not starting as this is not a VMware VM
landscape-client is not configured, please run landscape-config.
* Stopping CPU interrupts balancing daemon[74G[ OK ]
* Starting automatic crash report generation[74G[ OK ]
* Restoring resolver state... [80G [74G[ OK ]
* Stopping System V runlevel compatibility[74G[ OK ]
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.
Cloud-init v. 0.7.5 running 'modules:final' at Tue, 03 May 2016 11:45:45 +0000. Up 10.17 seconds.
ci-info: +++++Authorized keys from /home/ubuntu/.ssh/authorized_keys for user ubuntu++++++
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | Keytype | Fingerprint (md5) | Options | Comment |
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | ssh-rsa | fe:05:1e:f2:04:c4:df:4f:53:f2:4f:c3:ba:ac:10:51 | - | - |
ci-info: +---------+-------------------------------------------------+---------+---------+
ec2:
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 46:c0:bb:6c:65:04:13:fc:ab:2b:51:4f:1c:1e:75:dc root#testmachine (DSA)
ec2: 256 81:cd:f3:dd:66:7a:ca:4e:95:78:43:a7:dc:29:ad:fd root#testmachine (ECDSA)
ec2: 256 f5:d9:c7:59:92:af:fc:b7:56:42:ca:1e:f7:bb:5b:89 root#testmachine (ED25519)
ec2: 2048 6e:2d:1b:52:84:3f:28:04:95:41:81:15:af:61:e5:96 root#testmachine (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFfEl02HEegH7vohFTTS1bxA7LaIua/f+j0Uvi1u3j8fyTfzuVzqHl73QaBtE6uJ7EuTaoDhNCeeyWF+sLqMulI= root#testmachine
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGmcm55oSkblJ//oUcNQMqB2oO7BG2vXA0fhHEhlOQba root#testmachine
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc3VqU3V9of956GD0DhCc5YEbkBzOgOazVRiFxx31I2wW3Z5vnW+BgZLoRhB8Zj2Tbn70l7cPKcN3/orklZldhoSK4u0+0buqhArqqp+/JBmR5AXn6hlcRvpLU+KM1qFovJuwwuttelaB0vS9YzwCLiCODLp9A4mvOCFiCbxOpvz7Bt5mMlvBnZnN3iWNiAn4aMjCrxwuUGruTXnO9ffRMs6GC4WVazUD42cD34g4FUlPf1Dqlinau5bRQrNbrU8vhiXE+DhxQO4WMMulsYoKfVDxhRrokwNpS9rB1HhHd+VOh7iTwkEwszCPtsYSrXYVng8JZzHBdq94SrOU3D58Z root#testmachine
-----END SSH HOST KEY KEYS-----
Cloud-init v. 0.7.5 finished at Tue, 03 May 2016 11:45:46 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0]. Up 10.27 seconds
Ubuntu 14.04.4 LTS testmachine ttyS0
testmachine login:
I precise that ports 22, 80 and 2376 are open on the machine on OpenStack.
thanks, if someone could help me, it would be nice

TL;DR Try adding the following options:
--openstack-net-id or --openstack-net-name
--openstack-floatingip-pool
--openstack-sec-groups
Original answer:
I get the very same thing when running docker-machine 0.6.0 with the openstack driver. But v0.7.0 (build a650a40) works just fine for me. I'm running a centos image not ubuntu, but otherwise the same. Sorry, I've not used docker-machine in a while but try just grabbing the latest release and see if that helps.
Update:
Just double-checked what I ran above, I actually configured this with environment variables, specifying a few things additional to yours above. Specifically though, in addition to my openstack RC file, I set:
export OS_SSH_USER=centos
export OS_IMAGE_ID=c31637b9-455a-4849-8f46-2af1715f9dee
export OS_FLAVOR_NAME=m1.small
export OS_FLOATINGIP_POOL=INTERNAL-NETWORK
export OS_SECURITY_GROUPS=default
export OS_NETWORK_ID=b32e2700-8eac-4b7c-b9a8-16b6403927a2
and then ran:
docker-machine create -d=openstack testmachine

Related

Docker-machine can't use userdata add key to ssh cloud image

My provider : OpenStack
VM OS: Ubuntu 16.04
Docker-machine Version: 0.14.0
Problem:
I want to use userdata add another public key to authorized_keys,
using --openstack-user-data-file option to specify my userdata.yml.
Here is my userdata.yml:
#cloud-config
users:
- default
- name: ubuntu
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- ssh-rsa XXXXXXXXXXXXXX
Use docker-machine command to create vm:
docker-machine --debug create --driver openstack
--openstack-auth-url http://x.x.x.x:5001/v3
--openstack-domain-id defaule
--openstack-endpoint-type adminURL
--openstack-floatingip-pool ext-net
--openstack-keypair-name mykey
--openstack-flavor-id 4
--openstack-image-name ubuntu-16.04-cloud
--openstack-net-name private
--openstack-password XXXXX
--openstack-private-key-file /home/demo/id_rsa
--openstack-sec-groups default
--openstack-ssh-user ubuntu
--openstack-tenant-name admin
--openstack-user-data-file /home/demo/userdata.yml
--openstack-username admin
vm
After creating vm , docker-machine stuck " waiting for ssh to be available".
Here is debug output:
Getting to WaitForSSH function...
(vm) Calling .GetSSHHostname
(vm) Calling .GetSSHPort
(vm) Calling .GetSSHKeyPath
(vm) Calling .GetSSHKeyPath
(vm) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /root/.docker/machine/machines/vm/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none ubuntu#10.50.2.36 -o IdentitiesOnly=yes -i /root/.docker/machine/machines/vm/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : ssh command error:
command : exit 0
err : exit status 255
output :
I try to ssh to vm by command:
ssh -i /root/.docker/machine/machines/vm/id_rsa ubuntu#10.50.2.36
But got error message:
Permission denied (publickey).
So, I try another key , the key was in option of --openstack-private-key-file /home/demo/id_rsa
ssh -i /home/demo/id_rsa ubuntu#10.50.2.36
ssh was successful!
I checked two keys, /root/.docker/machine/machines/vm/id_rsa and /home/demo/id_rsa,
but two keys are the same.
I was confused, why the same keys, one can ssh another one can't ssh?
In order for Docker-Machine to set-up a virtual machine on OpenStack, you need to activate the config_drive option: docker-machine --openstack-config-drive [OTHER_OPTIONS] <MACHINE_NAME>

Why isn't ssh-agent authenticating the private key's passphrase when I use Ansible?

In short,
ssh-agent will authenticate the passphrase when I ssh into the remote server from the command line, but whenever I execute an ansible playbook it asks for the passphrase. My question is, why won't ssh-agent authenticate the passphrase for Ansible? How can I get it to work?
In detail,
I created a password protected private key and corresponding public key and uploaded the public key to the server.
I invoked the ssh-agent using eval $(ssh-agent) and then ssh-add /etc/ansible/ssh/private-key.pem
Typing ssh-agent -l shows that the key has been added.
I can successfully ssh into the machine from the command line using ssh username#ipaddress without being asked for the passphrase.
but if I execute a playbook or do something like sudo ansible -m ping server it will say
Enter passphrase for key '/etc/ansible/ssh/private-key.pem':
I tried it again in verbose mode and it gives me the following information
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg configured
module search path = [u'/etc/ansible/library']
ansible python module
location = /usr/lib/python2.7/dist-packages/ansible
executable
location = /usr/bin/ansible
python version = 2.7.12 (default, Nov 20
2017, 18:23:56) [GCC 5.4.0 20160609] Using /etc/ansible/ansible.cfg as
config file Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers Using module file
/usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<35.230.127.195> ESTABLISH SSH CONNECTION FOR USER: user6
<35.230.127.195> SSH: EXEC ssh -C -o ControlMaster=auto -o
ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o
'IdentityFile="/etc/ansible/ssh/private-key.pem"' -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=user6 -o ConnectTimeout=10 -o ControlPath=/home/user6/.ansible/cp/e26536be01 35.230.127.195 '/bin/sh
-c '"'"'echo ~ && sleep 0'"'"'' Enter passphrase for key '/etc/ansible/ssh/private-key.pem':
My Environment
Ansible version is 2.4.2.0
Python version is 2.7.12
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g
The ssh keys were created using RSA (not SSH-1 RSA)
and 4096 bits.
In ansible.cfg transport is set to smart.
The key is encrypted using ansible-vault, but I've tried doing it
without encryption and it makes no difference.
Please help, I don't have much hair left.
UPDATE: Using transport = local executes everything locally (ie it doesn't execute the ansible playbook on the remote server(even though it looks like it does)).
Go to ansible.cfg file at below location:
/etc/ansible/ansible.cfg
And set the transport = local :
transport = local
Thanks

Running ansible but keep getting failed to connect via ssh

MacBook-Pro:rails1 woo$ ssh vagrant#10.0.1.92
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-91-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Tue Jul 5 03:52:20 UTC 2016
System load: 0.0 Users logged in: 1
Usage of /: 4.0% of 39.34GB IP address for eth0: 10.0.2.15
Memory usage: 32% IP address for eth1: 10.0.1.100
Swap usage: 0% IP address for eth2: 10.0.1.92
Processes: 80
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Last login: Tue Jul 5 03:52:20 2016 from 10.0.1.19
vagrant#vagrant-ubuntu-trusty-64:~$
But,
>ansible -vvvv all -m ping -u vagrant
/Library/Python/2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
Using /Users/woo/vagrant_vms/rails1/ansible.cfg as config file
Loaded callback minimal of type stdout, v2.0
<10.0.1.92> ESTABLISH SSH CONNECTION FOR USER: vagrant
<10.0.1.92> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 10.0.1.92 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1467746604.02-144506913281055 `" && echo ansible-tmp-1467746604.02-144506913281055="` echo $HOME/.ansible/tmp/ansible-tmp-1467746604.02-144506913281055 `" ) && sleep 0'"'"''
10.0.1.92 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh.",
"unreachable": true
}
I've done:
cat ~/.ssh/id_rsa.pub | ssh vagrant#10.0.1.92 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
and it was successful as tested by the ssh command.
I don't understand why I keep getting the Failed to connect message.
The 10.0.1.92 is in the hosts file and the ip of the vm is set to that ip.
Can you try this:
ansible -vvvv all -m ping -u vagrant
Try to issue these two commands before connecting the vagrant box with Ansible.
$ eval $(ssh-agent -s)
$ ssh-add

regenerating certificates hangs on windows 7

I'm a total docker newbie and tried to get it working on my windows 7 64-bit machine.
The installation went okay, but the "Docker Quickstart Terminal" will not start up as expected. It seems to hang when trying to create the SSH key:
(default) Downloading https://github.com/boot2docker/boot2docker/releases/download/v
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(default) Creating VirtualBox VM...
(default) Creating SSH key...
Error creating machine: Error in driver during machine creation: exit status 1
Looks like something went wrong... Press any key to continue...
so I tried to regenerate the certificates in a cmd window and also this does not work:
>docker-machine regenerate-certs default
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Detecting the provisioner...
OS type not recognized
I've tried to deactivate my virus scanner and execute the cmd windows as admin without success.
Any ideas what to check? Are there any interesting logfiles?
here's the docker version output:
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.3
Git commit: a34a1d5
Built: Fri Nov 20 17:56:04 UTC 2015
OS/Arch: windows/amd64
An error occurred trying to connect: Get http://localhost:2375/v1.21/version: dial tcp 127.0.0.1:2375:
ConnectEx tcp: No connection could be made because the target machine actively refused it.
If you don't have hyper-v activated (that is more a Windows 10 issue), and if your BIOS VT-X/AMD-v is enabled, then something else went wrong.
If docker-machine ls still lists the default machine, delete it: docker-machine rm default.
If you had (previous to your docker-toolbox installation) a VirtualBox already installed, try and:
uninstall completely VirtualBox
in C:\Windows\system32\drivers\, find and delete these five files (there may be less left, that is ok, delete them anyway):
vboxdrv.sys,
vboxnetadp.sys,
vboxnetflt.sys,
vboxusbmon.sys,
vboxusb.sys.
in regedit, key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\, delete these 5 folders (there may be less left, that is ok, delete them anyway):
VBoxDrv,
VBoxNetAdp,
VBoxNetFlt,
VBoxUSBMon,
VBoxUSB.
Then reinstall the latest VirtualBox.
Make sure:
you have the latest docker-machine copied somewhere in your PATH (the 0.5.3 has been released 22 hours ago: releases/download/v0.5.3/docker-machine_windows-amd64.exe).
%HOME% is defined (typically to %HOMEDRIVE%%HOMEPATH%)
From there, try manually to recreate the default machine like the quick-start script did:
docker-machine create -d virtualbox --virtualbox-memory 2048 --virtualbox-disk-size 204800 default
eval $($DOCKER_MACHINE env my_new_container --shell=bash)
docker-machine ssh my_new_container
I've now tried to create a Linux VM directly in VirtualBox and start it from there: also gets some time-out. So I think it's not related to docker.
I've found a VirtualBox bug-report that says, that this can happen when you have Avira installed.
Here's a discussion about the issue on the Avira forum - unfortunatly mostly in German.
One paragraph indicates that it may help to deactivate "Advanced process protection":
Configuration -> General -> Security and disable the option "Advanced
process protection". Click "Apply" and restart the device. You should
be able to run your VM in VirtualBox after that.
In my case this does not help, so I'll need to wait for a fix or completely uninstall Avira.
(defualt) DBG | Getting to WaitForSSH function...
(defualt) DBG | Using SSH client type: external
(defualt) DBG | &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker#127.0.0.1 -o IdentitiesOnly=yes -i C:\Users\Ming.docker\machine\machines\defualt\id_rsa -p 58549] C:\Program Files\OpenSSH\bin\ssh.exe }
(defualt) DBG | About to run SSH command:
(defualt) DBG | exit 0
(defualt) DBG | SSH cmd err, output: exit status 255:
(defualt) DBG | Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
(defualt) DBG | command : exit 0
(defualt) DBG | err : exit status 255
(defualt) DBG | output :

Ansible script ssh error

I am creating a vm in openstack (linux vm) and launching ansible script from there.I am getting following ssh error.
---
- hosts: licproxy
user: my-user
sudo: yes
tasks:
- name: Install tinyproxy#
command: sudo apt-get install tinyproxy
- name: Update tinyproxy
command: sudo apt-get update
- name: Install bind9
shell: yes '' | sudo apt-get install bind9
Though I am directly able to ssh to machine 10.32.1.40 from the linux box in openstack admin-keydev29
PLAY [licproxy] ***********************************************************
GATHERING FACTS ***************************************************************
<10.32.1.40> ESTABLISH CONNECTION FOR USER: my-user
<10.32.1.40> REMOTE_MODULE setup
<10.32.1.40> EXEC ssh -C -tt -vvv -o StrictHostKeyChecking=no -o IdentityFile="/opt/apps/installer/tenant-dev29/ssh/admin-key-dev29" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=my-user -o ConnectTimeout=10 10.32.1.40 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238 && echo $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238'
EXEC previous known host file not found for 10.32.1.40
fatal: [10.32.1.40] => SSH Error: ssh: connect to host 10.32.1.40 port 22: Connection refused
while connecting to 10.32.1.40:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [Install tinyproxy] *****************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
I removed from known_host entry and ran the script again it is still showing me same message.
UPDATE
I observed manual ssh is working fine.but ansible script is giving ssh error.
I logged in to the newly created vm using ssh key and checked /var/log/auth.log file
Dec 30 13:00:33 licproxy-vm sshd[1184]: Server listening on :: port 22.
Dec 30 13:01:10 licproxy-vm sshd[1448]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Dec 30 13:01:10 licproxy-vm sshd[1448]: Connection closed by 192.168.0.106 [preauth]
Dec 30 13:01:32 licproxy-vm sshd[1450]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
The vm has sshd version OpenSSH_6.6.1 version
I checked /etc/ssh folder i found ssh_host_ed25519_key and ssh_host_ed25519_key.pub missing
I created those file using command ssh-keygen -A.
Now I want to know why these files are missing from ssh folder.Is this a bug?
Problem was because of ssh port 22.The port was not up.
I added the following code.which basically wait for ssh port to come up.
while ! nc -z $PROXY_SERVER_IP 22; do
sleep 10s
done