I am facin some ansible problems , making a simple ping/pong in my container from my host

Hi everyone ;), i am a really noobie guy over here, and on the top of that i am spanish :D. I have everything set up on my computer, and i would like to deploy something inside my unprivileged container, but if a simple ping/pong doesn’t work from ansible , ansible said is not running when it is running.

this is the command that it doesn’t work — sudo ansible container -m ping -u root --become

in my host file i have

[container]
10.0.3.154 ansible_connection=lxc

if i let this variable ansible_connection=lxc it said is not running
if i take off it said – Failed to connect to the host via ssh: root@10.0.3.154: Permission denied (publickey,password).\r\n"

but my rsa_id.pub is in the .ssh folder on the container in the authorized_keys file if some one can help me a little i would be so mercy with.

i hope i did use enough respect to all of you guys and i did.

i did start doing it a week ago, them try to understand that i am a really noobie guy dont get too ungry with me i will appreciate any help

I wonder if it’s a privileged vs unprivileged issue at the Ansible level, but I know nothing of the lxc backend for Ansible unfortunately.

You may have better luck reaching out to the Ansible folks or having them come answer your issue here.

1 Like

thank you so mach i apreciate your answer, i will go and take a look to the Ansible folks, and also to build up a new privileged container and to run my little test on it . thank you for the fast answer. have a great day :wink:
because my main problem is that i want to deploy a rest_framework projects (django) and py , and i don’t really know what i have to use for it unprivileged or priprivileged one, with the unprivileged one my only problems is to run a simple ping on the node, because afther that a want to run a playbooks to install what i need, i did before but to other servers, and i have my rsa key in the cointainer but it dont want to get connection , it was because i didn’t wanted to make it manually to install all of that haha but thanks again.

Hi,

Before launch any ansible commands or playbooks, prove your ssh connection from the host running ansible to your container. If it does not work, no ansible command or playbook will work. Launch a ssh root@10.0.3.154 and see if it works.

My host and the unprivileged container are running Ubuntu 16.04:
$ ansible lxd2 -m ping
192.168.1.89 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
My inventory /etc/ansible/hosts
$ cat /etc/ansible/hosts
# grupo contedores LXD2
[lxd2]
192.168.1.89
# variables grupo contenedores LXD
[lxd2:vars]
ansible_user=root
ansible_ssh_private_key_file=~/.ssh/id_rsa
ansible_python_interpreter=/usr/bin/python3

Salutes from Galicia :wink:

1 Like

Yes i did and i have total access trough the terminal but not with Ansible. Is an unprivileged container i don’t know if is that the problem. But thank you but tomorrow i will keep working around this i am so sorry i am a noobie one :wink:

hi good morning, i will do the same setups as you thanks again to share it.

thanks so much, it is working now, manuel i hope you have a great day i think i have being using the wrong id_rsa , i have use the id_rsa.pub to have ssh access and it wasn’t enough or it was wrong.
whatever, you are super nice to share and help me. have a great day wherever you are :wink:

gracias manuel hasta ahora no vi que eras español espero estes bien, oye como que hemos de pasar el certificado en lugar de la llave publica ? yo de un principio copie mi llave publica en el container y accedi mediante ssh, pero no me dejaba hacer un simple ping desde Ansible. despues de declarar esas despues de declarar esas variables en mi inventario paso sin problemas. gracias