Howto Ansible into remote LXC/LXD through SSH?

Trying not to reinvent the wheel: What would be the good way to connect into LXC containers running on a remote host, while only exposing SSH on the WAN side of the host itself?

Looking for something link this:
[Ansible] >> [SSH] >> [remote host-OS] >> [LXC containers running on remote host]

We are able to run Ansible playbook on the containers on the remote host through the LXD connection plugin. But this needs us to open up port for the LXD-connection to the outside world. Preferable the remote host would only expose the SSH-port used by ansible and nothing else.

What have other people done to solve this?
Thanx in advance :slightly_smiling_face:

The ansible-lxc-ssh connection plugin exists:

https://github.com/andreasscherbaum/ansible-lxc-ssh/

1 Like