# Use custom "ssh" command ?

**URL:** <https://forum.ansible.com/t/use-custom-ssh-command/20825>\
**Category:** Ansible Project\
**Created:** [March 10, 2016, 11:34am UTC](https://forum.ansible.com/t/use-custom-ssh-command/20825 "2016-03-10T11:34:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florent\_B](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Florent\_B](https://forum.ansible.com/u/Florent_B)\
**Post date:** [March 10, 2016, 11:34am UTC](https://forum.ansible.com/t/use-custom-ssh-command/20825/1 "2016-03-10T11:34:04Z")

</div>

Hi,

I would like my Ansible to use "autossh" command instead of "ssh" to  
connect to hosts in inventory.

Is there a way to do this ?

Thank you.

---

<div class="post-metadata">

**Author:** ![Rahul\_Patil](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@Rahul\_Patil](https://forum.ansible.com/u/Rahul_Patil)\
**Post date:** [March 10, 2016, 12:00pm UTC](https://forum.ansible.com/t/use-custom-ssh-command/20825/2 "2016-03-10T12:00:08Z")

</div>

Hi Florent,

I don’t have tried this but you can try, ssh command has been defined in `site-packages/ansible/runner/connection_plugins/ssh.py`

```auto
ssh_cmd += ["ssh", "-C"]

```

If autossh accept the same argument as ssh then it will work.

Best Regards,  
Rahul Patil

---

<div class="post-metadata">

**Author:** ![Florent\_B](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Florent\_B](https://forum.ansible.com/u/Florent_B)\
**Post date:** [March 10, 2016, 12:26pm UTC](https://forum.ansible.com/t/use-custom-ssh-command/20825/3 "2016-03-10T12:26:49Z")

</div>

Hi,

Thank you, I saw that “ssh” was written in source without having ability configuring it.

I saw I could set a “retries” option in ansible.cfg, that’s a cleaner solution than changing source. I will see…

---

<div class="post-metadata">

**Author:** ![Florent\_B](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Florent\_B](https://forum.ansible.com/u/Florent_B)\
**Post date:** [March 10, 2016, 12:35pm UTC](https://forum.ansible.com/t/use-custom-ssh-command/20825/4 "2016-03-10T12:35:58Z")

</div>

Do you know in which contexts are executed python commands like this ssh one ? This is to determine if I could use the “alias” in Bash for example…
