# Howto Ansible into remote LXC/LXD through SSH?

**URL:** <https://forum.ansible.com/t/howto-ansible-into-remote-lxc-lxd-through-ssh/11105>\
**Category:** Get Help\
**Created:** [November 24, 2024, 8:55pm UTC](https://forum.ansible.com/t/howto-ansible-into-remote-lxc-lxd-through-ssh/11105 "2024-11-24T20:55:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauricerosario](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@mauricerosario](https://forum.ansible.com/u/mauricerosario)\
**Post date:** [November 24, 2024, 8:55pm UTC](https://forum.ansible.com/t/howto-ansible-into-remote-lxc-lxd-through-ssh/11105/1 "2024-11-24T20:55:01Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![ads](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ads/32/747_2.png) [@ads](https://forum.ansible.com/u/ads)\
**Post date:** [November 25, 2024, 9:11am UTC](https://forum.ansible.com/t/howto-ansible-into-remote-lxc-lxd-through-ssh/11105/2 "2024-11-25T09:11:31Z")

</div>

The ansible-lxc-ssh connection plugin exists:

[https://github.com/andreasscherbaum/ansible-lxc-ssh/](https://github.com/andreasscherbaum/ansible-lxc-ssh/)
