At the same level where the host inventory is, create a file named 
ansible.cfg with the following:

[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
control_path = /dev/shm/cp%%h-%%p-%%r

That will solve your problem
El sábado, 6 de julio de 2019 a la(s) 13:30:45 UTC-5, Claudio Rivas 
escribió:

> Hi,
>
> I'm trying to connect to remote host through SSH and a Private Key to run 
> a simple test to start working with Ansible to generate my inventories:
>
> ansible -m ping -i hosts test1 -vvv
>
>
> Hosts file have a simple configuration
>
> [test]
>
>
> test1 ansible_host=remote_host ansible_user=remote_user 
> ansible_private_key_file=/var/jenkins_home/ansible/id_rsa
>
> SSH is working fine to connect to remote server with this key:
>
> jenkins@0bde7f6019a2:~/ansible$ ssh -i id_rsa remote_user@remote_host
>
> Enter passphrase for key 'id_rsa': 
>
> Last login: Fri Jul  5 12:10:51 2019 from jenkins.jenkins_net
>
> While trying to do the connection with ansible seems to have problems I 
> can't find or troubleshoot, the error indicates:
>
> *test1 | UNREACHABLE! => {*
>
> *    "changed": false, *
>
> *    "msg": "Failed to connect to the host via ssh: Control socket 
> connect(/var/jenkins_home/.ansible/cp/45a4bb8b49): Connection 
> refused\r\nFailed to connect to new control master", *
>
> *    "unreachable": true*
>
> *}*
>
>
> Any help will or advice be appreciated.
>
>
> Best regards,
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/58c1e5f5-369f-4f8a-82db-86fd4c0fae40n%40googlegroups.com.

Reply via email to