andreasscherbaum / ansible-lxc-ssh

Ansible connection plugin using ssh + lxc-attach
45 stars 22 forks source link

using sudo to run lxc-attach #3

Closed manelclos closed 3 years ago

manelclos commented 7 years ago

Hi, I tried to fix this in a number of ways, but ended up adding "sudo" in front of every "lxc-attach" command in the plugin.

I really need to login as non-root as root login is disabled, and that trick makes it work.

It would be nice to maybe have that "sudo" as an option, or use the same "become" method...

andreasscherbaum commented 7 years ago

I remember that I had some trouble when using non-root accounts, unfortunately. But can't remember exactly.

If this works for you, can you provide this as a PR, along with a config option for the become method?

trygvis commented 6 years ago

Just adding sudo works for me to. Don't know enough ansible to help out with patching yes :(

xMAC94x commented 5 years ago

I have the same problem, if the version suppors python3 #5 i could try to add something like a confuration that will execute a sudo before attach

andreasscherbaum commented 5 years ago

I think it's more complicated than just adding "sudo". You need to use whatever mechanism Ansible itself is using to gain root access, that might not be "sudo".