Trouble accessing LXC container

172 views
Skip to first unread message

Jay Pipes

unread,
Oct 26, 2013, 4:13:58 PM10/26/13
to ansible...@googlegroups.com
Hi all,

I've got a couple LXC containers running that I'm trying to experiment with Ansible on:

$ sudo lxc-ls --fancy
NAME         STATE    IPV4        IPV6  AUTOSTART 
-------------------------------------------------    
db           RUNNING  10.0.3.77   -     NO          
web          RUNNING  10.0.3.221  -     NO


And a hosts configuration as follows:

[web]
web ansible_ssh_user=ubuntu ansible_ssh_host=10.0.3.221

[db]
db ansible_ssh_user=ubuntu ansible_ssh_host=10.0.3.77


However, when I run my playbook, I'm getting errors trying to SSH to the containers:

http://paste.openstack.org/show/49894/

I can SSH to either IP address as the "ubuntu" user, but it asks for the password (also "ubuntu").

I'm not an SSH expert and I'm having trouble understanding what I need to do (either in my ~/.ssh/config or in Ansible environment variables) in order to get Ansible's SSH access working properly to these containers. Any help would be most appreciated, and sorry if this is a beginner question. I tried finding answers on the Google machine but was unsuccessful.

Do I need to log in to each container and configure SSH or inject an SSH key before I can use Ansible? Or is there a way that Ansible can do this somehow, perhaps with the virt Ansible module command(s)?

Best,
-jay

James Cammarata

unread,
Oct 27, 2013, 10:39:15 PM10/27/13
to ansible...@googlegroups.com
If you don't have a SSH key setup, you'll need to use --ask-pass (and have the askpass program installed) in order for it to prompt you for the password. You could write a play that deployed your key that way.


--
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-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

James Cammarata <jcamm...@ansibleworks.com>
Sr. Software Engineer, AnsibleWorks, Inc.
http://www.ansibleworks.com/

Kapil Thangavelu

unread,
Oct 28, 2013, 10:41:17 AM10/28/13
to ansible...@googlegroups.com
When creating a container (lxc-create) if your using the ubuntu or ubuntu-cloud template.. you can pass in an -S to pass a public key for future access. The ubuntu-cloud template also has support for -S on lxc-clone.


On Sat, Oct 26, 2013 at 1:13 PM, Jay Pipes <jayp...@gmail.com> wrote:

--

Jay Pipes

unread,
Oct 31, 2013, 12:29:40 AM10/31/13
to ansible...@googlegroups.com
Thanks Kapil and James, you got me in the right direction :) Problems solved!

Best,
-jay
Reply all
Reply to author
Forward
0 new messages