1

I'm using ansible on my local machine "A", manipulating remote host "B". Now I have containers "C1", "C2", etc. on that remote host. Can I use ansible to manipulate them, too? I.e. without having sshd installed in every container?

Of course, I can install sshd in every container and forward the respective port. It's just that I would like to avoid that.

Btw. all of the involved machines run Debian 9 (stable/stretch).

TIA!

Martin
  • 31
  • 3
  • It appears not natively, but are you willing to write your own ansible plugin? If that's an option, we can discuss how you might do so, but I don't want to get into it if you're not interested – mdaniel Nov 06 '18 at 05:30
  • Hi Matthew, thank you very much! Maybe in the future, I'll consider this, but for now, I'll just install sshd and sudo in the container and live with that. I had some hope, that I'm not the first one wanting this :) – Martin Nov 06 '18 at 16:21
  • 1
    I'm sorry I didn't think to search before commenting earlier, but it actually seems [someone has written an nsenter connector](https://github.com/tomoh1r/ansible-connection-nsenter), which I don't know if it will solve your specific problem, but might interest you anyway if you're doing a lot of work with nspawn – mdaniel Nov 07 '18 at 04:44
  • Many thanks again, Matthew! I'm not sure: Does this connector only connect from ansible to local containers? Mine are remote, so this might need some additional hop through ssh or something. – Martin Nov 07 '18 at 13:59
  • Yeah, regrettably I don't know as I don't have a system set up to try it out. But I mostly just wanted to make you aware in case you did decide to customize ansible for your needs. Good luck with everything! – mdaniel Nov 09 '18 at 04:25

0 Answers0