Here is the error message I get when I launch a playbook?
From the server, the ssh connection is made with the key.
Do you have an idea?
fatal: [xxx.xxx.xxx.xxx]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange", "unreachable": true}
ansible v.17
Related
i want use ansible-playbook (ansible-core 2.11.4 installed from pip3 install) but reply error
fatal: [172.17.12.16]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Shared connection to 172.17.12.16 closed.",
"unreachable": true
}
i have checked Password free login and use shell mode modular everything is ok
shell reply success
enter image description here
WinRM service is already running on this windows machine, but when I run my playbook against a Windows node I'm getting below error.
error:
fatal: [xx:xx:xx:xxx]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh_exchange_identification: Connection closed by remote host", "unreachable": true}
Could you please let me know if anything is missing or incorrect
Regards,
Priya P
As Zeitounator said:
Add winrm connection details. Ie. if you have an ini inventory with a windows group: (put the credentials in a vault)
[windows:vars]
ansible_user=<from vault>
ansible_password=<from vault>
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
ansible_port=5986
#ansible_port=5985
ansible_winrm_transport=ntlm
ansible_winrm_scheme=https
#ansible_winrm_scheme=http
I am new to Ansible and was tring to figure out how to establish a ssh connection via ansible.
I have created an ec2 instance(Linux) and i have controlling node as my local machine(Ubuntu).
Now, I have generated and added key from my local to remote instance. I am also able to ssh by running ssh ec2-user#.
But, when doing the same using ansible command
ansible -i hosts all -m ping -u ec2-user
I am getting error as:
ec2-user#13.127.222.56 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ec2-user#13.127.222.56: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).",
"unreachable": true
}
My hosts file is:
[test]
13.127.222.56
Now, I am unable to figure out how to work with this further. I am missing some authentication required by ansible because this usually comes only when ssh is unable to get the key.
Friends,
I am trying to run some ansible tasks against an EC2 instance and getting the following error:
fatal: [ubuntu]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to
the host via ssh: ssh: connect to host 34.218.130.84 port 22:connection timed out",
"unreachable": true}
I think, the problem is related to Ansible configuration because I tryed connecting with the instance via Putty using the same IP, username and pem-file and it worked just fine.
This is how my inventory file looks like:
[brt]
ubuntu ansible_ssh_host=34.218.130.84
ansible_ssh_private_key_file=/home/mjgoncalves/ansible/chave/aws-ansible.pem
[brt:vars]
ansible_ssh_private_key_file=/home/mjgoncalves/ansible/chave/aws-ansible.pem
ansible_ssh_host=34.218.130.84
ansible_ssh_user=username
ansible_ssh_pass=passowrd
ansible_become=yes
ansible_become_method=sudo
ansible_become_pass=password
ansible_connection=ssh
...
Any idea what I may be missing?
The "ssh" in the variable names has been deprecated. You should use ansible_host instead of ansible_ssh_host (same for username, password etc., but not for the ansible_ssh_private_key_file).
The IP in the message (connect to host 34.228.140.94) is not the same as in your inventory, so it seems that it does not take the IP from the variable, or you are overwriting it somewhere else.
On a CentOS machine, I can ssh into localhost. I can also successfully "sudo ansible -m ping localhost". Port 22 is also open. I can also run a playbook against localhost where "connetion : local".
However, when trying to do anything against localhost via ansible with SSH, I get the following:
localhost | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}
As far as I can tell, the other similar SO answer to a similar error here
does not really solve the problem as it basically says "well don't SSH then".