# Custom Connection Plugin or other solutions?

**URL:** <https://forum.ansible.com/t/custom-connection-plugin-or-other-solutions/17752>\
**Category:** Ansible Project\
**Created:** [March 16, 2015, 1:52pm UTC](https://forum.ansible.com/t/custom-connection-plugin-or-other-solutions/17752 "2015-03-16T13:52:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [March 16, 2015, 1:52pm UTC](https://forum.ansible.com/t/custom-connection-plugin-or-other-solutions/17752/1 "2015-03-16T13:52:20Z")

</div>

Hi,

I have a situation with a special kind of bastion host. As far as I read the connection type plugins (ssh, paramiko\_ssh, winrm) it seems that this is the only way to actually do this, see below for a typical session that needs to happen.

Any other ideas short of writing a connection plugin?

I’m even thinking about simply dropping ansible on the bastion host and be done with it. I’m not sure I want to get into the details of actually tunneling ansible from my local workstation thru the bastion host to have an easier time running the commands…

At my current customer there’s no control whatsoever on changing this weird bastion host setup, I have neither control nor a chance to change it. So please don’t suggest a change to the setup. It is just a requirement.

This is the shell situation for a typical session:

# start a “simple” ssh session form the bastion host

bastion[~]$ bastion\_ssh.sh ansible-controlled-host root

root@ansible-controlled-host[~]$ # do whatever admin task is required

root@ansible-controlled-host[~]$ exit

bastion[~]$ bastion\_ssh.sh ansible-controlled-host root

# equivalent of scp (no equivalent of sftp operations)

## local to remote

urp\_scp.sh test root@vievmnislp2:/tmp/

## remote to local (note no recursive stuff!)

urp\_scp.sh root@vievmnislp2:/tmp/

# equivalent of ssh root@target uptime

bastion[~]$ bastion\_script.sh ansible-controlled-host root uptime

# switching users (sorry no sudo)

bastion\_script.sh ansible-controlled-host root “su someuser -s /bin/bash -c’whoami’”
