# chaining ssh and lxd connections

**URL:** <https://forum.ansible.com/t/chaining-ssh-and-lxd-connections/21896>\
**Category:** Ansible Project\
**Created:** [June 29, 2016, 8:33pm UTC](https://forum.ansible.com/t/chaining-ssh-and-lxd-connections/21896 "2016-06-29T20:33:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavel\_Stratil](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Pavel\_Stratil](https://forum.ansible.com/u/Pavel_Stratil)\
**Post date:** [June 29, 2016, 8:33pm UTC](https://forum.ansible.com/t/chaining-ssh-and-lxd-connections/21896/1 "2016-06-29T20:33:05Z")

</div>

Hi,

I wonder if/how is it possible to chain ssh and lxd connections in order to manipulate lxd/docker containers on remote physical servers

thanks, Pavel

---

<div class="post-metadata">

**Author:** ![Paul\_Totterman](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Paul\_Totterman](https://forum.ansible.com/u/Paul_Totterman)\
**Post date:** [June 30, 2016, 7:46am UTC](https://forum.ansible.com/t/chaining-ssh-and-lxd-connections/21896/2 "2016-06-30T07:46:02Z")

</div>

> I wonder if/how is it possible to chain ssh and lxd connections in order to manipulate lxd/docker containers on remote physical servers

Are the lxd or docker containers reachable by SSH? Are the addresses routable to your ansible control host? Just use SSH.

If not routable, but are running SSH, you can probably use ProxyCommand in ssh\_config. e.g. ProxyCommand ssh -W %h:%p

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Pavel\_Stratil](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Pavel\_Stratil](https://forum.ansible.com/u/Pavel_Stratil)\
**Post date:** [June 30, 2016, 10:18pm UTC](https://forum.ansible.com/t/chaining-ssh-and-lxd-connections/21896/3 "2016-06-30T22:18:15Z")

</div>

yep, proxycommand came to my mind as well. still i’d love to keep the containers as simple as possible (without sshd running) and just connect to them via their connector, only not on local, but rather the remote host, so that i could define my inventory file along the lines of i.e.

localhost ansible\_host=127.0.0.1 ansible\_connection=local ansible\_user=localuser  
google ansible\_host=8.8.8.8 ansible\_connection=ssh ansible\_user=remoteuser  
bind@google ansible\_connection=lxd # this tells to connect to google via its (ssh) connector and then to continue to connect to bind@google via lxd.

so basically, i’m looking if ansible can do piping/pxoxying connectors/connections.
