# SSH trouble with Ansible 1.3.2 and LXC

**URL:** <https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 27, 2013, 9:58pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571 "2013-09-27T21:58:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shantanu\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Shantanu\_Kumar](https://forum.ansible.com/u/Shantanu_Kumar)\
**Post date:** [September 27, 2013, 9:58pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/1 "2013-09-27T21:58:53Z")

</div>

Hi,

Newbie here. I am using Ansible 1.3.2 on Ubuntu 13.04 and LXC. I have copied my SSH public key into the box’s ~/.ssh/authorized\_keys and I can SSH passwordlessly on the command line. When I try Ansible commands I get SSH error:

~/mybox$ ansible-playbook -vvv -i hosts.txt site.yml

PLAY [tomcat-servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 ESTABLISH CONNECTION FOR USER: ubuntu  
 EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/shantanukumar/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘hosts’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1380318604.29-40373890357519 && chmod a+rx $HOME/.ansible/tmp/ansible-1380318604.29-40373890357519 && echo $HOME/.ansible/tmp/ansible-1380318604.29-40373890357519’”]  
fatal: [hosts] =\> SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/shantanukumar/site.retry

hosts : ok=0 changed=0 unreachable=1 failed=0

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 27, 2013, 10:08pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/2 "2013-09-27T22:08:15Z")

</div>

Could you run it with the -vvvv (4 v’s) as recommend and show the output?

---

<div class="post-metadata">

**Author:** ![Shantanu\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Shantanu\_Kumar](https://forum.ansible.com/u/Shantanu_Kumar)\
**Post date:** [September 27, 2013, 10:11pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/3 "2013-09-27T22:11:57Z")

</div>

Hi James,

> Could you run it with the -vvvv (4 v’s) as recommend and show the output?

I ran it with 4 v’s and here’s the output:

~/mybox$ ansible-playbook -vvvv -i hosts.txt site.yml

PLAY [tomcat-servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 ESTABLISH CONNECTION FOR USER: ubuntu  
 EXEC [‘ssh’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/shantanukumar/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘hosts’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1380319822.8-236525636193412 && chmod a+rx $HOME/.ansible/tmp/ansible-1380319822.8-236525636193412 && echo $HOME/.ansible/tmp/ansible-1380319822.8-236525636193412’”]  
fatal: [hosts] =\> SSH encountered an unknown error. The output was:  
OpenSSH\_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012  
debug1: Reading configuration data /etc/ssh/ssh\_config  
debug1: /etc/ssh/ssh\_config line 19: Applying options for \*  
debug1: auto-mux: Trying existing master  
debug1: Control socket “/home/shantanukumar/.ansible/cp/ansible-ssh-hosts-22-ubuntu” does not exist  
debug2: ssh\_connect: needpriv 0  
ssh: Could not resolve hostname hosts: No such file or directory

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/shantanukumar/site.retry

hosts : ok=0 changed=0 unreachable=1 failed=0

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 27, 2013, 10:18pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/4 "2013-09-27T22:18:56Z")

</div>

So it looks like your hosts.txt file is not formatted properly, could you show that please?

---

<div class="post-metadata">

**Author:** ![Shantanu\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Shantanu\_Kumar](https://forum.ansible.com/u/Shantanu_Kumar)\
**Post date:** [September 27, 2013, 10:21pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/5 "2013-09-27T22:21:08Z")

</div>

> So it looks like your hosts.txt file is not formatted properly, could you show that please?

The file content is verbatim below:

~/mybox$ cat hosts.txt  
[hosts]  
#10.0.3.181  
10.0.3.188

[tomcat-servers]  
hosts

Shantanu

---

<div class="post-metadata">

**Author:** ![Michael\_Baydoun](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Michael\_Baydoun](https://forum.ansible.com/u/Michael_Baydoun)\
**Post date:** [September 27, 2013, 11:44pm UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/6 "2013-09-27T23:44:28Z")

</div>

Put the names of your tomcat servers under the group label  
If you have two hosts named foo and bar it would look like this:

[tomcat-servers]  
foo  
bar

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 28, 2013, 1:05am UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/7 "2013-09-28T01:05:16Z")

</div>

It should be:

[tomcat-servers:children]  
…

to signify that the name is a group of groups.

---

<div class="post-metadata">

**Author:** ![Shantanu\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Shantanu\_Kumar](https://forum.ansible.com/u/Shantanu_Kumar)\
**Post date:** [September 28, 2013, 4:39am UTC](https://forum.ansible.com/t/ssh-trouble-with-ansible-1-3-2-and-lxc/13571/8 "2013-09-28T04:39:10Z")

</div>

Thanks James and Michael!

Shantanu
